Hey everyone!
I’m not a coder with only some basic knowledge about html…
With the help of google I was able to create an element, that on down scroll changes to another element using an anchor. When scrolling back up it changes back to the starting element.
So far so good, but unfortunately the anchor doesn’t only trigger when reaching the screen from the button (and when leaving), it also changes the element when leaving the screen at the top, makes sense? This particularly takes effect when using a laptop size screen, on a bigger monitor the anchor doesn’t reach the top part of the window…
I also tried using two different anchors to separate entry and exit but to no avail I guess I’m missing some sort of cancel snippet for both the entry and exit part… but that’s where I’m totally overwhelmed.
Here’s a test link to a skeleton draft:
https://milanfritzinger.wixsite.com/website-2?siteRevision=6
The landing page and first menu item “Our Team” has elements on the sides I’m referring to.
As an example, the code snippet of “Our Team” below.
Thanks so much for any tips in advance!!!
$w.onReady(function () {
let fadeOptions = {
"duration": 200,
"delay": 0
};
$w("#anchorx").onViewportEnter((event) => {
$w('#donatebutton').show("fade", fadeOptions);
});
$w("#anchorx").onViewportEnter((event) => {
$w('#donatebuttonfull').hide("fade", fadeOptions);
});
$w("#anchorx").onViewportLeave((event) => {
$w('#donatebutton').hide("fade", fadeOptions);
});
$w("#anchorx").onViewportLeave((event) => {
$w('#donatebuttonfull').show("fade", fadeOptions);
});
});