Is there any way to not letting a function execute when the page is at the top or on a certain anchor?
This is the function I have, which runs as soon as the Mouse-wheel scrolls:
$(document).on('mousewheel DOMMouseScroll', function(MyFunction) {
// some stuff is happening
});
I want to add these two conditions:
- when the page is at the top I want MyFunction to work only when I scroll down.
- If the page is at a certain anchor for example
<a id="MyAnchor">
MyFunction works only when I scroll up.
Is it even possible? Please let me know if I am not clear and if you need more explanation, thank you.