Home Tutorial Jquery The scroll browser event of jQuery

 
 

Share on Google+Share on Google+
The scroll browser event of jQuery
Posted on: August 5, 2010 at 12:00 AM
Advertisement
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

Advertisement

Related Tags for The scroll browser event of jQuery:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 5, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com