Reputation: 655
i have a website it like 1800px in height. i want when user scrolldown around 200px it show an div on the top of the layout and its should stick with the page. when user scroll back to top , the div should disappear.
Upvotes: 2
Views: 4657
Reputation: 43810
You can use the jquery scroll method
$(window).scroll(function () {
$("span").css("display", "inline").fadeOut("slow");
});
Upvotes: 0
Reputation: 14330
You can trigger an event on scroll
:
$(window).scroll(function() {
if ($(this).scrollTop() > 0) {
topDiv.show();
} else {
topDiv.hide();
}
});
Upvotes: 5