scrollTop() gets the current scroll bar vertical position for the first element in a set of matched elements. It can also get the get the current scroll bar vertical position for every matched element vertical position of the scroll bar. The vertical scroll position is always similar to the number of pixels hidden from the view n top of the scrollable area. If your scroll bar is at the top, or the element isn’t scrollable, this value will be 0.
Ex.
To get the scrollTop of any paragraph.
<!DOCTYPE html>
<html>
<head>
<style>
p { margin:15px;padding:5px;border:4px solid #666; }
</style>
<script src="http://code.domain.com/jquery.js"></script>
</head>
<body>
<p>Hello there</p><p></p>
<script>var p = $("p:first");
$("p:last").text( "scrollTop:" + p.scrollTop() );
</script>
</body>
</html>
JQuery scrollTop()
scrollTop() gets the current scroll bar vertical position for the first element in a set of matched elements....
jquery scrolltop
Also tagged with one or more of these keywords: jquery, scrolltop
Designer's Resources →
Tutorials →
Creating a Form in CSS and JQUERYStarted by Salwa, 16 Jul 2014 create form, css, jquery |
|
|
||
Web Design →
Javascript →
jQuery stop()Started by DesGuru, 02 Nov 2012 jquery, stop method |
|
|
||
Web Design →
Javascript →
How to Access iFrame Elements in jQueryStarted by SmartWeb, 16 Aug 2012 access, iframe elements, jquery |
|
|
||
Web Design →
Javascript →
How to Loop through Elements Backwards in jQueryStarted by SmartWeb, 16 Aug 2012 backwards, elements, jquery, loop |
|
|
||
Web Design →
Javascript →
How to delay animation in jQueryStarted by SmartWeb, 16 Aug 2012 animation, delay, jquery |
|
|
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users