简体   繁体   中英

HTML Anchor Link - Offseting Position

I have Created an Example Page Below:
http://glustik.com/glustik2/index.html

When you Click the First Two Links you can see how the Anchors Position to the top and not down (250 or so Pixels).

Is there a way to summon the anchors to a certain location on the window?

Thanks.

您可以使用jQuery动画函数将scrollTop设置到所需位置。

$("html, body").animate({ scrollTop: $("#your-div").offset().top - YourHeadersHeight }, 500);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM