Your Open Source

 
Related Posts
JavaScript  >>  JQuery

findout the scrollbar position

In JQuery, you can findout the current scroll bar position of the DIV element. Please check it out the following example for that,

The stylesheet (css) code given below,


div#container{
width:598px;
float:left;
overflow:auto;

}

HTML code,


text here

Jquery in Javascript(JS) code,

$(document).ready(function(){
$('#container').scroll(function(){
var divOffset = $('#container').offset().left;
var pOffset = $('#container p:eq(2)').offset().left;
var pScroll = 598 - pOffset;
$('#print').html('Left:'+ pScroll);
});
});


You will get the scroll bar left position when you move the scroll bar of the DIV element.

  • hits 343
  • datetime Mar 05 09 11:05:03
  • author Sekar
  • rating

Rating : 12345
Tags :- JQuery

Answers

No Answers..
Your Name:
Your Answers :
<> is a code tag
Preview
Enter the verification code: