我是靠谱客的博主 含糊啤酒,这篇文章主要介绍jquery实现的点击页面动画方式平滑定位到某元素代码,现在分享给大家,希望可以做个参考。

$('.menu-item>a').click(function(){
var id = $(this).attr("data-href");   
$('html,body').animate({scrollTop:$(id).offset().top}, 800);
});

<a href="javascript:void(0);" data-href="#home" >集团介绍</a>

<div class="bannerM" id="home"></div>

转载于:https://www.cnblogs.com/dyy-dida/p/9198191.html

最后

以上就是含糊啤酒最近收集整理的关于jquery实现的点击页面动画方式平滑定位到某元素代码的全部内容,更多相关jquery实现内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部