To attach scroll event to a html element, scroll()
method can be used.
<script>
$(window).scroll(function () {
$("#divScroll").css("display", "inline").text("You are scrolling").fadeOut("slow");
});
</script>
In the above code when user scrolls the window then “You are scrolling” text is written in the “divScroll” element with fading effect slowly (we will learn about .fade() method in following post).
Views: 5004 | Post Order: 83