This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user