is $w().scrollTo() broken?

I’m trying to use $w(“#myElement”).scrollTo() but is doesn’t work on my live site, works fine in preview.

I’ve noticed a lot of people posting they have the same issue.

What is going on Wix???

can anyone help with this?

If your code is all set up correctly, then in theory it should work fine:
https://www.wix.com/corvid/reference/wix-window.html#scrollTo

import wixWindow from 'wix-window';

// ...

wixWindow.scrollTo(100, 500)
  .then( ( ) => {
    console.log("Done with scroll");
} );

However, if Wix have a bug somewhere with the scrollTo command, then it does need to be fixed asap.

Although, it might not be that straightforward for Wix to fix if it ends up being the fault of Devs of internet browsers like Chrome, where they end up breaking the scrollTo function for all previous versions when it gets updated, of which they have done before.

For example:
Chrome devs have decided to break (scrollTo) auto scroll for all websites built prior to Chrome 61
jQuery.scrollTo stopped working from Chrome 61

Some users got around it by the use of setTimeout().
If I add a timeout of 100ms, the scrollTo library works using load/onReady listeners with Chrome 62.

setTimeout(function(){
    $(window).scrollTo('#myDiv');
}, 100); 

If you coded your own website and are able to update jQuery.scrollTo the latest version, then it would probably work again for you.

However, as we can’t do that ourselves with the use of Wix Editor, we are left waiting for Wix to either find a fix for us, or we do a work around like setting a setTimeout.

Can I use... Support tables for HTML5, CSS3, etc

Thanks for the great comment. I find it weird that my code works fine in preview but not on live site…

@jamie

Perhaps because the Wix Editor Preview is just set up like an emulator or like a localhost, so it will run everything regardless if there isn’t any errors on your site like in the code somewhere.

However, when it is published and you try viewing it on your actual browser, then you are using the browser’s settings and not Wix’s.

See here for which browsers support scrollTo:
https://caniuse.com/#search=scrollTo

How do I escalate an issue like this? Wix support are no help and tell me to raise this issue in the forum. Does anyone have any ideas how I can escalate a potential bug to Wix?