Make named anchor bookmarks appear always at top of the screen when clicked

后端 未结 12 618
耶瑟儿~
耶瑟儿~ 2021-01-03 04:21

I have my markup as follows:

  • Sheds & Housing
  • <
    12条回答
    •  迷失自我
      2021-01-03 05:22

      try this fiddle: http://jsfiddle.net/dKfVL/9/

      I'm not sure this is possible with css alone (at least not cross-browser anyway).

      I've used jQuery to make sure that the #med_vac element has enough height to ensure the title will appear at the top of the page. I've set the code to run when the window is resized so it will also respond to any screen size changes.

      Hope this helps!

    提交回复
    热议问题