var fixed = false;
$(document).scroll(function() {
if
($(this).scrollTop() >= 220) {
if
(!fixed) {
fixed = true;
$('div').css({
position: 'fixed', top: 20 }); }
} else
{
if
(fixed) {
fixed = false;
$('div').css({
position: 'static' });
}
}
});
No comments:
Post a Comment