从href向下滚动到div [英] Scroll Down from a href to div
本文介绍了从href向下滚动到div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用jQuery从href向下滚动到特定的div,我的代码是:
i want to scroll down with jQuery from a href to a specific div , my code is :
<ul class="menu2">
<li><a href="#whoweare">About</a></li>
<li><a href="#services">Services</a></li>
</ul>
<div id="whoweare"></div>
<div id=services "></div>
谢谢
推荐答案
$(".YourClass").click(function () {
$('html,body').animate({ scrollTop: $(this.hash).offset().top }, 500);
});
这篇关于从href向下滚动到div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文