Jump to content

  • Free consultations and support
  • Live chatClick Here for Live Chat
  • Call ico 1888-906-1888
    Phone support: Open

    Ready for your call :)

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams

    Phone support: Closed

    We are back in: 1h 20m

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams


JQuery scrollTop()

jquery scrolltop

  • Please log in to reply
 

#1 SmartWeb

SmartWeb

    Senior Member

  • Designer
  • 271 posts

Posted 12 March 2013 - 10:31 PM

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>





Also tagged with one or more of these keywords: jquery, scrolltop

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users