$(function() { var offset = $("#logo").offset(); var topPadding = 15; $(window).scroll(function() { if ($(window).scrollTop() > offset.top) { $("#logo").stop().animate({ marginTop: $(window).scrollTop() - offset.top + topPadding }); } else { $("#logo").stop().animate({ marginTop: 0 }); }; }); });
No comments:
Post a Comment