diff --git a/src/routes/photos.svelte b/src/routes/photos.svelte
index 06f568b..abb9fdd 100644
--- a/src/routes/photos.svelte
+++ b/src/routes/photos.svelte
@@ -7,8 +7,8 @@
import { quartOut } from 'svelte/easing'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime.js'
- import { map, lerp } from '$utils/functions'
import { getAssetUrlKey } from '$utils/helpers'
+ import { map, lerp, throttle } from '$utils/functions'
// Components
import Metas from '$components/Metas.svelte'
import IconEarth from '$components/atoms/IconEarth.svelte'
@@ -50,14 +50,21 @@
$: currentPhotosAmount = photos.length
$: ended = currentPhotosAmount === totalPhotos
- // Container margins
+
+ /**
+ * Container margins
+ */
let scrollProgress: number
- let sideMargins: number = 8
- $: if (browser && window.innerWidth >= 768) {
- const viewportScroll = innerHeight / innerWidth <= 0.6 ? innerHeight * 1.5 : innerHeight
- scrollProgress = map(scrollY, 0, viewportScroll, 0, 1, true)
- sideMargins = lerp(8, 30, scrollProgress)
- }
+ let sideMargins: number = innerWidth < 1200 ? 16 : 8
+ $: viewportScroll = (innerHeight / innerWidth) <= 0.6 ? innerHeight * 1.5 : innerHeight
+
+ // Define sides margin on scroll
+ const setSidesMargin = throttle(() => {
+ if (window.innerWidth >= 992) {
+ scrollProgress = map(scrollY, 0, viewportScroll, 0, 1, true)
+ sideMargins = lerp(innerWidth < 1200 ? 16 : 8, 30, scrollProgress)
+ }
+ }, 50)
/**
@@ -186,7 +193,10 @@
image=""
/>
-
+