Pagination Bar Keeps Page Scrolled to Bottom

Hi folks,
I have a pagination bar that controls a Wix Pro Gallery. I have the gallery set so each page displays 50 photos before you have to go the next page. Unfortunately, after a user scrolls through all the photos on a given page and then clicks on the pagination bar to go to the next page, the next page is already scrolled all the way to the bottom instead of starting at the top.

Is there a way to code the page to always go back up to the top of the page once a new “page” of photos is loaded?

Thank you!

3 Likes

Hi,

This can be achieved with code.

import wixWindow from 'wix-window';

$w.onReady(function () {
    $w('#pagination1').onClick(() => {
        $w('#header1').scrollTo();
    })
});

Thanks, Ido!

@gehess @admin-23 Hi guys,
thank you also Ido for the answer. I would have another question related to it, please. What to do if it tells me that ‘onClick’ does not exist on ‘#pagination1’. What should I do next please?

I am designing it for a repeater having 30 pictures gallery per page. Thank you!

I am not coding, how to fix this in normal editor mode? All my links to pages open the page at the bottom, and then jump to the top…

Hello Tarryn Hanekom,

remember this is a code related-forum. But anyway, so you have some pics of your project? Or even better a little video, to see the behaviour of your issue?

If you do not use any code, so it sounds a little bit strange.

EDIT:


And next time, please do not reopen old posts. Open your own post with own issue-topic.

Thanks for the reply.

Ido, thank you so much!

OK, it works, but how to make it instant? Instead of smooth scrolling, that is.