I have added top menu as a div with position: fixed. It's placed in the top of the page, so it covers part of the content. I moved the layout down, so generally it's ok, BUT if user clicks any anchor link, the page scrolled to where the anchor is on top. But it's covered by the top menu. Is there a way to catch anchor event and process it with javascript (and jQuery if necessary)?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
You need to calculate the offset of the element and sroll to the
offset of element - height of the navigationbar
- position:See it in action here.
You can use something like this:
To get the anchor position
To make the offset related to the fixed menu
To make move the scroll
http://api.jquery.com/scrollTop/
http://api.jquery.com/position/