The scroll browser event of jQuery


 

The scroll browser event of jQuery

In this tutorial ,we will print message on browser's window scrolling using scroll browser event of jQuery.

In this tutorial ,we will print message on browser's window scrolling using scroll browser event of jQuery.

The scroll browser event of jQuery

In this tutorial ,we will print message on browser's window scrolling using scroll browser event of jQuery. In this example, some paragraphs are written , when we scroll down, a message will be displayed in line with the paragraphs.

scrollBrowserEvent.html

<!DOCTYPE html>
<html>
<head>
<style>
div { color:red; }
p { color:blue; }
span { color:red; display:none; }
</style>
<script src="jquery-1.4.2.js"></script>
</head>
<body>
<div>Try scrolling the iframe.</div>
<p>Try to scroll this paragraph - <span>It's Scrolling now!</span></p>
<script>
$("p").clone().appendTo(document.body);
$("p").clone().appendTo(document.body);
$("p").clone().appendTo(document.body);
$("p").clone().appendTo(document.body);
$("p").clone().appendTo(document.body);
$("p").clone().appendTo(document.body);
$(window).scroll(function () {
$("span").css("display", "inline").fadeOut("slow");
});

</script>
</body>
</html>

OUTPUT

Before scrolling :

After scrolling :

Download Source Code

Click here to see demo

Ads