ScrollTo only working in Preview...

I’m having a few issues with using the ScrollTo function – the most important of which is that is seems to only work in Preview. I’ve tried different browsers and playing around with a few bits of the code to see if that made any difference (like scrolling to a strip instead of an anchor, or having no collapsed items on the page) but none of this made a difference. Can anyone help make this work!?

What I’m doing – I have multiple menus, as you scroll down the page, one disappears and the other appears. I’m using this here within my shop, so when you first get to the page, I’d like the page to load at the shop menu which starts about 600px down the page. But I cannot get the ScrollTo to work on the live published site. See the video below for the Preview version where the page loads using the ScrollTo code then the rest of the code executes correctly. My issue is that on the live site it does not scroll onReady, and/or if it does it jumps back to the top of the page.

See code:

$w.onReady( function () {
$w(“#anchor5”).scrollTo();
$w(“#shopMenu”).show();
$w(“#shopStrip”).show();
$w(“#shopCart”).expand();
$w(“#siteMenu”).hide();
$w(“#siteStrip”).hide();
$w(“#siteCart”).collapse();
$w(“#socialMediaBox”).hide();
});

export function anchor1_viewportEnter(event) {
$w(“#siteMenu”).show();
$w(“#siteCart”).expand();
}

export function anchor1_viewportLeave(event) {
$w(“#siteMenu”).hide();
$w(“#siteCart”).collapse();
}

export function anchor2_viewportEnter(event) {
$w(“#socialMediaBox”).show();
}

export function anchor2_viewportLeave(event) {
$w(“#socialMediaBox”).hide();
}

export function anchor3_viewportEnter(event) {
$w(“#siteStrip”).show();
$w(“#shopStripTemp”).hide();
}

export function anchor3_viewportLeave(event) {
$w(“#siteStrip”).hide();
$w(“#shopStripTemp”).show();
}

export function anchor4_viewportEnter(event) {
$w(“#shopStrip”).hide();
$w(“#shopMenu”).hide();
$w(“#shopCart”).collapse();
}

export function anchor4_viewportLeave(event) {
$w(“#shopStrip”).show();
$w(“#shopMenu”).show();
$w(“#shopCart”).expand();
}

You’ll see I move between several anchors in order to achieve the appearing/disappearing menu items, so I don’t know if this is impacting how the ScrollTo code is working. Is there a way to JUMP to a location on the page On Ready instead of scroll?

Thanks in advance to anyone who can shed a little light!!!
Annie

You don’t seem to be the only one. I’m using a very simple export function header1_viewportLeave(event) / Enter(event) sequence and it’s suddenly stopped working for me as well. It still works in preview, but it no longer works on the live site. I came here to ask the same question you are.

i have spent two days re making my site because that exact function would not work as I view it from the outside , meaning visit as a live site , the export function (shrinking header) works perfect in preview, I am very annoyed , I could learn to code it in a different platform in much less time , I am on the verge of abandoning wix , if its all flash and no substance behind their platform.