I have this navbar hider script for handheld devices:
function bindNavUp() {
var lastScrollTop = 0, delta = 5;
$(window).on('scroll', function() {
var st = $(this).scrollTop();
if(Math.abs(lastScrollTop - st) <= delta) {
retu;
};
if (st > lastScrollTop) {
// downscroll code
$('header.main').css('top','-50px').hover();
}
else {
// upscroll code
$('header.main').css('top','0');
};
lastScrollTop = st;
});
};
function unbindNavUp() {
$(window).unbind('scroll');
};
function handleNavUp() {
if ($(window).width() < 1600) {
bindNavUp();
}
else {
unbindNavUp();
};
};
$(document).ready(function() {
var timer;
$(window).on('load resize scroll', function() {
clearTimeout(timer);
timer = setTimeout(function() {
handleNavUp();
}, 100);
});
handleNavUp();
});
The problem with this is that upscrolling works great with Jquery 2.2.1:
https://jsfiddle.net/Lanti/03kw42o1/4/
But not with Jquery 3 Beta 1, the hidden elements of the header not coming back (I use Firefox latest):
https://jsfiddle.net/Lanti/03kw42o1/5/
Also, with Jquery 3 I've got lots of console errors: TypeError: c is null
I haven't got any of this with Jquery 2.2.1, but both cases I also feel a huge performance drop when this script is applied to the normal, non-responsive view of my design.
