I have this code: http://jsfiddle.net/KCb5z/7/
It is designed to allow me to click links on the yellow bar and also have it be pesistent. It seems to work for the most part but on transition scrolling down it glitches around the part where the yellow bar becomes persistent at the top of the page.
I believe it is this bit of code which is causing it:
var $select = $('#select');
var $window = $(window);
var isFixed = false;
var init = $select.length ? $select.offset().top : 0;
$window.scroll(function () {
var currentScrollTop = $window.scrollTop();
if (currentScrollTop > init && isFixed === false) {
isFixed = true;
$select.css({
top: 0,
position: 'fixed'
});
} else if (currentScrollTop <= init && isFixed === true) {
isFixed = false;
$select.css('position', 'relative');
}
});
Is it obvious what is causing the issue, because if you scroll all the way down to the bottom it works fine.
scrollTopon nav click toscrollTop: $(divId).offset().top - $select.height()to make sure you offset the height of the navbar and the user can see the top of the section