Recently, I developed a menu that moves along with the window position as users scroll. However, an unexpected glitch occasionally occurs when scrolling up and down in Chrome 30 with OS X 10.9 and Windows 7. Interestingly, hovering over the anchor tag causes it to jump to the correct position (1 pixel above). Could there be an issue in my code? Is this a known bug?
Feel free to take a look at this JSFiddle Demo!
$(document).ready(function(){
$(window).scroll(function(){
var newTop = ($(window).scrollTop() + 40) +'px';
$('#menu').stop().animate({ top: newTop}, 500);
});
});
Update: Good news - the issue is resolved in Chrome 31.