Trying to trigger an animation once on scroll, but it triggers multiple times.
$(window).scroll(function(){
var y = $(window).scrollTop();
var flagscroll=true;
if( y < 30 && y > 20 && flagscroll==true ) {
flagscroll=false;
$('[data-label="SearchPanel"]').animate({
top: "-=34px",
}, 200 );
}
});
What am I missing here? Thanks for your ideas!