I'm using jQuery-1.10.2 and I am using the function $(window).scroll
. The $(window).scroll
isn't being executed as I scroll on a mobile device, but rather when my finger releases the screen after scrolling. $(window).scroll
is also delayed on IE10.
I use $(window).scroll
to make a navbar scroll with the page by changing the css property top:
on the position:fixed;
navbar. When scrolled down for enough, the navbar ends up sticking to the top of the page as position:fixed
. Is there a more compatible alternative to achieve the same results to my navbar? Is there a fix for mobile or IE10?
$(window).scroll(function () {
$('.navbar').css('top', Math.max(0, 350 - $(this).scrollTop()));
var scroll = $(document).scrollTop();
});
Here is a fiddle with no images. Look at the navbar. http://jsfiddle.net/93tzq/