How to use Event Scroll() Method in JQuery
In this article I am going to explain about event scroll() method in jquery.
jQuery Event Scroll() Method
jquery Scroll() method triggers the Scroll method and its occurs when user scrolls to any element through mouse or keyboard. And its also specifies what done at time of when scroll event occurs.
Syntax
$(selectElement).Scroll()
|
Example
This example is showing how many time scroll done on element.
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
mm = 0;
$(document).ready(function () {
$("div").scroll(function () {
$("h1").text(mm += 1);
});
});
</script>
</head>
<body>
<p>
Scroll this item</p>
<div style="width: 250px; height: 100px; overflow: scroll; background-color: yellow;">
Hiiiii....Hello how are you. Where are you living in this time. This is the fun
<br />
Hiiiii....Hello how are you. Where are you living in this time. This is the fun.
Its only for entertainment purpose and not a part of jquery programing</div>
<p>
Scroll Time
<h1 style="color: Red">
0</h1>
:</p>
</body>
</html>
|
Output
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here