Encountering an unusual problem in Chrome with the navbar-brand element of my website's bootstrap navigation menu.
We feature a larger site logo in the header section, along with a smaller logo inside the navbar-brand element which is initially set to display:none. As users scroll down the page, we affix the navbar to the top of the browser and reveal the navbar-brand element. Upon scrolling back up, the small logo should hide to make room for the large logo.
This functionality works seamlessly in IE and Firefox, but experiences some issues in Chrome. While the logo shows upon scrolling down and hides on scrolling up, the menu items do not shift back to their original position when the logo is hidden. Interestingly, clicking on any menu entry corrects this issue and shifts the menu entries back into place.
The code itself is quite simple, so I don't believe that is the root of the problem;
$(window).scroll(function () {
if ($(this).scrollTop() > $('header').height()) {
$('.navbar-brand').show();
} else {
$('.navbar-brand').hide();
}
});
I have created a stripped-down jsfiddle showcasing the problem at https://jsfiddle.net/96jqnu38/3/
I am unable to figure out how to prompt Chrome to redraw/repaint the menu entries back into their correct positions.
(Chrome 43.0.2357.81 on Windows 8.1)