=======================
1
========================
$(window).bind('scroll', function() {
if ($(window).scrollTop() > 50) {
$('.menu').addClass('fixed');
}
else {
$('.menu').removeClass('fixed');
}
});
============================
2
================================
$(document).ready(function() {================================
var navpos = $('#mainnav').offset();
console.log(navpos.top);
$(window).bind('scroll', function() {
if ($(window).scrollTop() > navpos.top) {
$('#mainnav').addClass('fixed');
}
else {
$('#mainnav').removeClass('fixed');
}
});
});
0 comments:
Speak up your mind
Tell us what you're thinking... !