[英]How can I make a menu that makes the browser window slide to a div?
Ok, so here is the effect I am attempting to emulate: 好的,所以这是我试图模仿的效果:
http://www.lukestevenson.me/ http://www.lukestevenson.me/
http://sohacks.com/ http://sohacks.com/
Notice how when a menu item is clicked on, the menu slides to the appropriate div. 请注意,当单击菜单项时,菜单会滑动到相应的div。 How can I do this with my menu?
我怎么能用菜单做到这一点? My website is at willowlake.github.io .
我的网站是willowlake.github.io。
Thanks. 谢谢。
EDIT : Thanks guys! 编辑:谢谢你们! Don't waste any more of your time on this simpleton question, it has been answered in depth.
不要在这个简单的问题上浪费你的时间,它已经得到了深入的回答。
Use this 用这个
Tiny Scrolling is a small script dedicated to support the navigation between the internal links and their destinations. Tiny Scrolling是一个小脚本,专门用于支持内部链接和目的地之间的导航。 It replace that annoying and confusing jump from various part of a page with a smooth scroll of the page itself.
它用页面本身的平滑滚动替换了页面各个部分的令人讨厌和令人困惑的跳转。
Take a look at this: 看看这个:
Add this to your script
and you will be able to get the effect. 将此添加到您的
script
,您将能够获得效果。
$('#idOfYourMenuItem').click(function(){
$('html, body').animate({ scrollTop: $('#idOfYourDiv').offset().top });
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.