Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Location
    Toronto, ON
    Posts
    102
    Thanks
    12
    Thanked 1 Time in 1 Post

    Scroll up by specified number of pixels

    Hi guys,

    My site has links in it with hash tags so people can share information externally, and when the link is clicked on my page loads already scrolled down on the correct div. ex. http://www.mysite.com/#div123

    My issue is the top of the div is aligned exactly on the top of the text in div123. Since the browser automatically scrolls there, is there a way to make the page scroll up by 20 pixels just to make it look nicer?

    Thanks!!

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    726
    Thanks
    35
    Thanked 132 Times in 123 Posts
    Code:
    scrollBy(0,-20)


  •  

    Posting Permissions

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