javascript - Wondering whats in this script causing it not to work in the new jquery update -
here link fiddle looking @ i'm looking for:
https://jsfiddle.net/mariusc23/s6mlj/31/
upon attempting apply own purposes realized not working @ all. came conclusion version using causing not work..
not javascript/ jquery buff wondering precisely in script causing not work jquery 3.0.0-rc1 instead older version jquery 1.10.2
// hide header on on scroll down var didscroll; var lastscrolltop = 0; var delta = 5; var navbarheight = $('header').outerheight(); $(window).scroll(function(event){ didscroll = true; }); setinterval(function() { if (didscroll) { hasscrolled(); didscroll = false; } }, 250); function hasscrolled() { var st = $(this).scrolltop(); // make sure scroll more delta if(math.abs(lastscrolltop - st) <= delta) return; // if scrolled down , past navbar, add class .nav-up. // necessary never see "behind" navbar. if (st > lastscrolltop && st > navbarheight){ // scroll down $('header').removeclass('nav-down').addclass('nav-up'); } else { // scroll if(st + $(window).height() < $(document).height()) { $('header').removeclass('nav-up').addclass('nav-down'); } } lastscrolltop = st; }
Comments
Post a Comment