3

I'd like to scroll to a position that is for ex 20px above an anchor. What is the best solution for this?

EDIT: I'm going to use scrollTo with jquery. Couldn't figure out window.location.hash.

1
  • Do you still need to do this? I missed the edit, see.
    – Ry-
    Commented Aug 18, 2012 at 2:34

1 Answer 1

5

Scroll to the anchor (by setting window.location.hash, maybe) then do window.scrollBy(0, -20), for example.

Not the answer you're looking for? Browse other questions tagged or ask your own question.