Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var h_hght = 105; // высота шапки
var h_mrg = 0; // отступ когда шапка уже не видна
$(function(){
$(window).scroll(function(){
var top = $(this).scrollTop();
var elem = $('.top_nav');
if (top+h_mrg < h_hght) {
elem.css('top', (h_hght-top));
} else {
elem.css('top', h_mrg);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.