Scroll up with pagination bar

hello there community i am using pagination bar on a repeater and when the user clicks to change the page its working fine except that id does not scroll up to the top… stays right there at the bottom…
i am using code like this but it does not seem to work
import wixWindow from ‘wix-window’ ;

export function pagination3_change(event) {
wixWindow.scrollTo( 0 , 0 )
.then( ( ) => {
console.log( “Done with scroll” );
} );
}

if i use on click event it does work but it scrolls even if nothing is changed but simply clicked on the pagination bar…

Another problem is that it first scrolls up and then changes the page…

Anyone having an idea?

Anyone is having and idea??

Same issue

Just got it solved by using this code:

import wixWindow from ‘wix-window’ ;
$w . onReady ( function (){
$w ( ‘#pagination1’ ). onClick (() => {
$w ( ‘#header1’ ). scrollTo ();})});

look the original post:

Yes thx and it needs a little bit of delay for the new page to load first and then scroll

Thanks cjcengenhariaeprojetos,
You can also change onClick to onChange, then it will work as bilisanas asked in his first post