简体   繁体   English

用Waypoint平滑滚动jquery(animation)

[英]smooth scroll with waypoints jquery(animation)

I'm trying to make a smooth scrolling in my new website. 我正在尝试在新网站中平滑滚动。

Look at this site: http://asher-gallery.com/ 查看此网站: http : //asher-gallery.com/

There is 3 blocks that I want to link to "a href=#(.*)" that I could make smooth scroll same like that: http://asher-gallery.com/1/ . 我想将3个块链接到“ a href =#(。*)”,这样我就可以像这样平滑滚动: http : //asher-gallery.com/1/

I change the parameters and its moving to the block location but not with animate... 我更改参数并将其移动到块位置,但不设置动画。

I hope you guys may help me with this ! 我希望你们可以帮助我!

THX! 谢谢!

如果将其包装在click事件中,则类似的东西应该起作用

$("html, body").animate({ scrollTop: $('#element-to-scroll-to').offset().top }, 300);

CSS类不能以数字开头,如果您的类类似于class =“ 1” ,则代码将被忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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