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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -