Dear people, I am using scrollTo in the code of a page. However, it only works on my desktop browser and not on any of my mobile browsers. Is there anything specific I need to do to make code also work on mobile, or does scrollTo only function on desktop? Apologies if I overlooked something obvious…
Just in case, this is what I used:
import wixWindow from ‘wix-window’;
$w.onReady(function () {
wixWindow.scrollTo(200, 800);
});
Curiously, the console log never seems to report anything. Also not when run a preview on my desktop.
On desktop, the scrolling works fine, but neither the first, nor the second console.log in the code below seem to do anything.
:-s
$w.onReady(function () {
console.log("Console test message");
wixWindow.scrollTo(200, 800).then(() => {
console.log("Done with scroll");
});
});
(how does one properly embed code on this forum? apologies I'm a total noob here...)
I had the same issue with the scrollTo function on my mobile browser. It seems that it does not scroll to the correct height position in mobile (live view).
export function Button1_click(event) {
$w('#Strip1').scrollTo();
}
I used the work around in this discussion and it does solve the issue for the mobile browser, but it does not navigate to the correct height position in the desktop browser.
export function Button1_click(event) {
wixWindow.scrollTo(0, 110);
}
Is there a way to make the scrollTo function more responsive to device size?