jquery - Trying to have header back to normal when scrolling back up, it keeps looping the fadeOut -
trying have header normal when scrolling up, keeps looping fadeout:
// main content window $('.main').scroll(function() { if ($(this).scrolltop() > 400) { //header $('header').slideup(500).delay(800).fadeout(400); } else { $('header').slideup(500).fadein(400); } }
use below code . add .stop() before animation start
description: stop currently-running animation on matched elements.
if ($(this).scrolltop() > 400) { //header $('header').stop().slideup(500).delay(800).fadeout(400); } else { $('header').stop().slideup(500).fadein(400); }
Comments
Post a Comment