Search code examples
javascriptpositionscreensliding

How to obtain the screen's height position in a long html page?


enter image description here

I have a sliding screen on a long HTML page with left and right columns. How can I obtain the height position of the screen in the HTML page, knowing users use sliding bars? I need this to slide the left and right column content to follow users' movement. Thanks.

P.S.: I am using JQuery (if it helps).


Solution

  • You can use scrollTop to find the vertical scroll position of any DOM element.

    $('#element').scrollTop()

    Some other useful functions: scrollLeft() , offset() , position()