Bootstrap 3 here and here's my jsFiddle. I really like my header navbar, but would like to tweak it so that it 'snaps' or 'pins' to the top of the page as the user views, almost exactly like they do it on Rancher. With the only difference being, they transition from a transparent background to a black one, and I just want to stick with a solid gray background at all times.
Looking at that page source, I can't quite lock in on where the trick is because most of their JS is pretty heavily minified. Any ideas as to how I could achieve this?
Maybe some JS magic like so (?):
$(window).scroll(function(){
var fixIT = $(this).scrollTop() >= navPos;
var setPos = fixIT ? 'fixed' : 'relative' ;
var logoSH = fixIT ? 'show' : 'hide' ;
$('#nav').css({position: setPos});
$('#mini-logo')[logoSH](300);
});
Thoughts?