diff --git a/src/routes/[country]/[location]/index.svelte b/src/routes/[country]/[location]/index.svelte index dfc8f1e..554d28f 100644 --- a/src/routes/[country]/[location]/index.svelte +++ b/src/routes/[country]/[location]/index.svelte @@ -118,24 +118,26 @@ }) // Photos MutationObserver - mutationPhotos = new MutationObserver((mutationsList) => { - // When adding new childs - for (const mutation of mutationsList) { - if (mutation.type === 'childList') { - // Observe new items - Array.from(mutation.addedNodes) - .filter(item => item.nodeType === Node.ELEMENT_NODE) - .forEach((item: HTMLElement) => observerPhotos.observe(item)) + if (photos.length) { + mutationPhotos = new MutationObserver((mutationsList) => { + // When adding new childs + for (const mutation of mutationsList) { + if (mutation.type === 'childList') { + // Observe new items + Array.from(mutation.addedNodes) + .filter(item => item.nodeType === Node.ELEMENT_NODE) + .forEach((item: HTMLElement) => observerPhotos.observe(item)) + } } - } - }) - mutationPhotos.observe(photosListEl, { - childList: true, - }) + }) + mutationPhotos.observe(photosListEl, { + childList: true, + }) - // Observe existing elements - const existingPhotos = photosListEl.querySelectorAll('.house') - existingPhotos.forEach(el => observerPhotos.observe(el)) + // Observe existing elements + const existingPhotos = photosListEl.querySelectorAll('.house') + existingPhotos.forEach(el => observerPhotos.observe(el)) + } /** @@ -191,7 +193,7 @@ diff --git a/src/style/pages/_location.scss b/src/style/pages/_location.scss index f94699e..6e0e600 100644 --- a/src/style/pages/_location.scss +++ b/src/style/pages/_location.scss @@ -233,4 +233,18 @@ } } } + + // Message + &__message { + padding: clamp(96px, 24vw, 360px) 0 clamp(96px, 16vw, 280px); + text-align: center; + color: $color-text; + font-size: rem(24px); + font-weight: 200; + line-height: 1.4; + + @include bp (sm) { + font-size: rem(28px); + } + } } \ No newline at end of file