SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru rashidr's Avatar
    Join Date
    Jun 2004
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to find how near we are from bottom of the page

    How to find how near we are from bottom of the page

    What I am doing is If we are scrolling page and page is reach just near the bottom (100px), I want to change the sidebar position by css,

    Can anyone help me?

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An easy solution to get this working would be to get the document's total height and deduct 100px's from this value.

    Then on the scroll event figure out how far down the page the user has scrolled (e.g. using the window.pageYOffset (non ie) and document.body.scrollTop (ie) property. If the the distance the user has scrolled is equal to or greater than the lower limit of the page, then move your sidebar.

    Good luck

  3. #3
    SitePoint Guru rashidr's Avatar
    Join Date
    Jun 2004
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but I already figured it out. did the same thing.

    Quote Originally Posted by SlickAU View Post
    An easy solution to get this working would be to get the document's total height and deduct 100px's from this value.

    Then on the scroll event figure out how far down the page the user has scrolled (e.g. using the window.pageYOffset (non ie) and document.body.scrollTop (ie) property. If the the distance the user has scrolled is equal to or greater than the lower limit of the page, then move your sidebar.

    Good luck


Bookmarks

Posting Permissions

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