Want to achieve hung div
I want top: -50px; for cases the scrollbar is between 0 and 50. When the
scrollbar goes down, I want the .articlebutton to hung and stuck to zero
margin of the screen, which will be calculated by the difference between
between scrollbar - 50px, I Think I might have some syntax error. Any help
kindly appreciated.
http://jsfiddle.net/LhL7u/2/
var difference = scrollTop - 50px;
$(window).scroll(function () {
if ($(window).scrollTop() > 50) {
$(".articlebutton").css("top", "difference");
}
else {
$(".articlebutton").css("top", "-50px");
}
});
No comments:
Post a Comment