www.webdeveloper.com
Results 1 to 3 of 3

Thread: Page Height browser property??, how to monitor where the user is...?.

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Posts
    281

    Page Height browser property??, how to monitor where the user is...?.

    i'm wondering what browser property i can use to monitor where the user is in terms of page height?

    let's say the page is 1356 pixels in height. the user is going to have to scroll up and down to view page elements. right now i need to write a sort of utility function that monitors where the user currently is.

    what browser property exists that i can use for this? is there some sort of scrollTop or scrollPageHeight property?

    one reason i want to do this is because i've employed a parallax js library to use for navigation and animation both and need some sort of readout to track where i currently am on the page

    any help would be much appreciated, thanks!

  2. #2
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    document.documentElement.scrollTop || document.body.scrollTop ;

  3. #3
    Join Date
    Mar 2010
    Posts
    281
    belated thanks -
    yeah i need to monitor that property. here's my little utility app in case anyone finds it useful for any reason

    PHP Code:
    <style>
     
    body {height:3200px
     
    #readout { position:fixed;top:0;left:0;height:25px;width:45px;border:2px solid red;background:#000;color:#fff;}
    </style>

    <
    script type="text/javascript">
                $(
    window).scroll(function(){
                   
    theVar document.body.scrollTop;
                     $(
    "#readout").html(theVar);
                 })  
    </script> 
    uses the jQuery scroll() method

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles