Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Armani's avatar
Level 17

Overflow hidden causes the scroll to be preserved

I have a page that contains a slideshow using Swiper and because for a slideshow to work as it should, it applies overflow of hidden to the div. When I use Link component of Inertia in the same page and click on the link, it causes the page scroll to be preserved. I mean when I come to the bottom of the page and click on a link, when it goes to another page, it won't go to the top of the page.

I used this code to fix the issue:

router.on('finish', () => {
    window.scrollTo(0, 1);
});

Is there a better way to fix this issue?

0 likes
2 replies

Please or to participate in this conversation.