I make a small jquery script. When you scroll on the page and your are over 350. Than a button is show. When you going back, the button is hide. This is the script:
var button = $('a[title*="terug naar boven"]');
$(document).bind('scroll', function(e) {
if (window.scrollY > 350) {
button.animate ({
opacity: 1
})
}
if (window.scrollY < 350) {
button.animate ({
opacity: 0
})
}
});
But the problem is. That the script succession is. When i scroll. The script is fire everytime. How can i fix this? That is script is fire one time.