SSR
All checks were successful
deploy to production / deploy (push) Successful in 1m7s

This commit is contained in:
2023-12-06 20:11:49 +00:00
parent 82f2bf9233
commit d3b36a6716
24 changed files with 166 additions and 119 deletions

View File

@@ -30,13 +30,15 @@
function imageSlide(images: HTMLImageElement[]) {
let currentImage = 0
images[0].classList.add("show-img")
let interval = setInterval(() => {
images[currentImage].classList.remove("show-img")
currentImage += 1
if (images.length == currentImage) currentImage = 0
images[currentImage].classList.add("show-img")
}, 4000)
return () => clearInterval(interval)
if (typeof window !== "undefined") {
let interval = setInterval(() => {
images[currentImage].classList.remove("show-img")
currentImage += 1
if (images.length == currentImage) currentImage = 0
images[currentImage].classList.add("show-img")
}, 4000)
return () => clearInterval(interval)
}
}
function pushImages(node: HTMLImageElement) {
@@ -44,11 +46,14 @@
}
$: {
const images = Array.from(document.getElementsByClassName("img-menu")) as HTMLImageElement[]
if (images.length !== 0) {
imageSlide(images)
if (typeof window !== "undefined") {
const images = Array.from(document.getElementsByClassName("img-menu")) as HTMLImageElement[]
if (images.length !== 0) {
imageSlide(images)
}
}
}
function stretchText() {
let container = document.getElementById("logo-container")
let textElement = document.getElementById("upper")
@@ -83,9 +88,10 @@
textElement.style.letterSpacing = `${newLetterSpacing}px`
}
}
window.addEventListener("resize", stretchText)
onMount(stretchText)
if (typeof window !== "undefined") {
window.addEventListener("resize", stretchText)
onMount(stretchText)
}
</script>
<ul>
@@ -111,7 +117,7 @@
<button
class="button-three"
on:click="{(e) => {
let element = document.getElementById('menu')
let element = document?.getElementById('menu')
if (element) changeStateOfSite(element.classList.contains('show-menu'))
}}"
aria-controls="primary-navigation"
@@ -210,7 +216,7 @@
<img
use:pushImages
src="{`${apiBaseURL}navigation/${$navigation.id}/${imgSrc}?filter=${
window.innerWidth > 500 ? 'xl' : 'm'
window?.innerWidth > 500 ? 'xl' : 'm'
}`}"
alt="img"
class="img img-menu"