Code working on preview, not live

Hi,

The question is about the site: www.leonards .be

On the page leonards .be/kopen and leonards .be/huren i’ve implemented some basic code to let my page go up after people press on next page. Before this the page changed but stayed on low level.
The code is:

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

The problem:
The code works very well on preview mode, but not on the live site when published. I’ve tried to find an answer online for a few hours, without any luck.

Anyway that could offer a solution to this problem?

Hey @artsiomsukhadolski :raised_hand_with_fingers_splayed:

I recommend using the onChange( ) event handler instead of the click handler, it does make sense.

Please try it and let me know how it goes.

Ahmad

Hi Ahmad,

Thanks a lot for the quick reply. I just changed it to

$w.onReady( function () {
$w( ‘#pagination1’ ).onChange(() => {
$w( ‘#header1’ ).scrollTo();
})
});

Works perfectly on preview, but still does not work in published version of the website. Am i doing something wrong?

@artsiomsukhadolski This issue is related to our performance rollout. Please check your site again and let me know if it’s fixed. Thanks.

@artsiomsukhadolski No, as Marlowe said, it’s most likely related to the rollout that they’re releasing.

Hey guys,

Thanks a lot, works perfectly!

Have a great day.

Happy to hear that :blush: