# Code working in editor preview but not on site on published site

**URL:** <https://forum.wixstudio.com/t/code-working-in-editor-preview-but-not-on-site-on-published-site/19952>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [September 17, 2019, 1:28am UTC](https://forum.wixstudio.com/t/code-working-in-editor-preview-but-not-on-site-on-published-site/19952 "2019-09-17T01:28:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pekafisher](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@pekafisher](https://forum.wixstudio.com/u/pekafisher)\
**Post date:** [September 17, 2019, 1:28am UTC](https://forum.wixstudio.com/t/code-working-in-editor-preview-but-not-on-site-on-published-site/19952/1 "2019-09-17T01:28:17Z")

</div>

I’m having trouble with my frozen menu. I’ve coded it so that my main menu shows when the page loads however on scrolling down, another menu shows up and the main menu disappears.

The issue I am having is that the code is working when i preview while in editor mode however when i save and view the published site the code doesn’t work. So it’s only working in editor preview. Has anyone had this encounter before?

The code is:

export function smallstrip\_onviewportEnter(event, $w)  
{  
$w(“#smallstrip”).hide();  
$w(“#menutext”).hide();  
$w(“#largebutton”).hide();  
$w(“#logo”).show();  
$w(“#largestrip”).show();  
$w(“#menu”).show();  
$w(“#smallcontactbutton”).show();  
}

export function largestrip\_onviewportLeave(event, $w)  
{  
$w(“#smallstrip”).show();  
$w(“#menutext”).show();  
$w(“#largebutton”).show();  
$w(“#logo”).hide();  
$w(“#largestrip”).hide();  
$w(“#menu”).hide();  
$w(“#smallcontactbutton”).hide();  
}

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [September 17, 2019, 7:32pm UTC](https://forum.wixstudio.com/t/code-working-in-editor-preview-but-not-on-site-on-published-site/19952/2 "2019-09-17T19:32:47Z")

</div>

Like this one for example.  
[https://www.wix.com/corvid/forum/community-discussion/fixed-frozen-header-example](https://www.wix.com/corvid/forum/community-discussion/fixed-frozen-header-example)

---

<div class="post-metadata">

**Author:** ![pekafisher](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@pekafisher](https://forum.wixstudio.com/u/pekafisher)\
**Post date:** [September 17, 2019, 9:28pm UTC](https://forum.wixstudio.com/t/code-working-in-editor-preview-but-not-on-site-on-published-site/19952/3 "2019-09-17T21:28:17Z")

</div>

Yes like this. I’m having the same issue though when i changed my code to this one. It works in editor preview mode but not on the published site. Any ideas what I could be doing wrong?

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [September 17, 2019, 10:08pm UTC](https://forum.wixstudio.com/t/code-working-in-editor-preview-but-not-on-site-on-published-site/19952/4 "2019-09-17T22:08:06Z")

</div>

@pekafisher

See Lior’s new post on his forum post about the header.

---

<div class="post-metadata">

**Author:** ![pekafisher](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@pekafisher](https://forum.wixstudio.com/u/pekafisher)\
**Post date:** [September 18, 2019, 12:51am UTC](https://forum.wixstudio.com/t/code-working-in-editor-preview-but-not-on-site-on-published-site/19952/5 "2019-09-18T00:51:22Z")

</div>

@givemeawhisky Thank you givemewhisky! My menu is working perfectly now 🙂
