Hi,
I have a little code under the “site" section of my site, www.letsstartdesign.com . that controls the menu and hamburger menu. The menu is supposed to glide away on viewport leave.
It was working just fine but I noticed today that it doesn’t seem to be working now on the live site. If I preview the site it works. Any ideas?
Heres the code under the site section: let glideOptions = {
“duration”: 1000,
“delay”: 0,
“angle”: 90,
“distance”: 250,
};
export function horizontalMenu1_viewportLeave_1(event) {
$w(‘#horizontalMenu1’).hide (“glide”,glideOptions);
}
//horizontalMenu1 is the site menu that is supposed to glide in and out.
You need to make an adjustment to your code.
$w( ‘#horizontalMenu1’ ).show(‘glide’,{ “duration”: 1000, “delay”: 0, “angle”: 90, “distance”: 250 });
The effect options is to be the second parameter to the show function.
Hi @givemeawhisky thanks for the suggestion but that didn’t work. It is weird that it works on the preview but not the published site anymore. Obviously if it was data you would sync it to live but this code is in the site code section.
I think your problem is that you are trying to hide horizontalMenu1 when it leaves its own viewPort. It wouldn’t make sense this way. It will be like matching a logic to itself like
if(sigma === sigma)
You should call the horizontalMenu1 to hide on some other element’s viewport Leave such as an anchor
Thank you @shan. So I added an anchor to each page and then added the code to each page and did a leave viewport event for each of the anchors and this worked. I’m glad I didn’t have too many pages to configure. Thank you.