wixWindow.scrollBy not showing on live site

I have a button that when clicked changes the image in a gallery and scrolls to the top of the page (to 1200px). it works good in preview mode but in the live site it does not work, just changes the image but does not scroll. what is the problem? how can I solve this issue?
this is the code. thanks!

import wixWindow from ‘wix-window’;

// …
export function Button01_click(event, $w) {
$w(‘#Gallery’).next()
wixWindow.scrollBy(0, -1200)
.then(() => {
console.log(“Done with scroll”);
});

}

Hi!

Your code seems to be fine.
Please share a link to your site so we can inspect it and provide you with a solution.

Doron.

Hi Doron, this is the page: https://neurosestudio.wixsite.com/neuros/atabeyguali
I’m trying to make a comic viewer, that whe you clic the buttons changes the page and moves the page to the top so you can start reading from the top.

Hi!

It seems like its an issue on our side.
I’ll be happy to update in this thread when it is resolved.

Meanwhile, I can suggest you an easy workaround.
Add an anchor to your desired location and use the following code to scroll to it:

export function button1_click(event, $w) {
  $w("#anchor1").scrollTo()
    .then(() => {
      console.log("Done with scroll");
    });
}

Hope it helps.
Best of luck!

Doron. :slight_smile:

I tried using scrollTo() but is scrolls to smooth. I want to jump to the top of the comic, I used scrollBy() because scrolls faster and is close to a jump in location. in any case I will be waiting for the update on the issue.
by the way, do you know if is possible to use the arrows keys of the keyboard to control the $w(’ #Gallery ').next()

Thanks for your help Doron.

Hey again Fausto!

The issue is now solved.
You can use scrollBy( ) on live site and it works properly.

P.s
I really liked your comics!!
I’ll be following your site :slight_smile:

Doron.

1 Like

thanks a lot Doron! and I’m glad that you liked my comics :slight_smile: