$(document).ready(function(){
$("#sticky-header").hide();
});
$(window).scroll(function(){
if( $(document).scrollTop() > 160 ) {
$.fx.speeds._default = 300;
$('#sticky-header').show();
$("#sticky-header").transition({ y: 60 });
} else {
$.fx.speeds._default = 0;
$('#sticky-header').clearQueue().transition({ y: 0 });
$('#sticky-header').hide();
}
});
Here's my code: http://jsfiddle.net/de74ezo5/
I am trying to slide a new navigation down when scrolling past the top header, and then hide it when returning. Is there a more efficient way to do this? Possibly with CSS transitions? My method appears clunky and inefficient to me. The animation tends to be jumpy sometimes.