失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > jQuery实现自动滚动到页面顶端办法【jquery】

jQuery实现自动滚动到页面顶端办法【jquery】

时间:2023-10-05 20:44:39

相关推荐

jQuery实现自动滚动到页面顶端办法【jquery】

web前端|js教程

jQuery,自动滚动,页面顶端

web前端-js教程

本文实例讲述了jQuery实现自动滚动到页面顶端的方法。分享给大家供大家参考。具体实现方法如下:

mongodb 源码,vscode鸿蒙,ubuntu 郑码,两个tomcat效果怎么样,go操作sqlite,网页设计学生版,境外服务器自助建站,discuz插件启用,阿里前端框架 ,梦见一地爬虫,php健身,seo丹青,os 网站模板,项目开发网页,vpn模板,bootstrap 页面内跳转,图书馆管理系统架构,斗地主源程序lzw

$(".scroll").click(function(event){ //prevent the default action for the click event event.preventDefault(); //get the full url - like mysitecom/index.htm#home var full_url = this.href; //split the url by # and get the anchor target //name - home in mysitecom/index.htm#home var parts = full_url.split("#"); var trgt = parts[1]; //get the top offset of the target anchor var target_offset = $("#"+trgt).offset(); var target_top = target_offset.top; //goto that anchor by setting the body scroll top to anchor top $(html, body).animate({scrollTop:target_top}, 500);});​

legendshop 源码 c2c,vscode vue 代码提示,ubuntu xen,tomcat7 jdbc,sqlite 问号,网页设计湖南,php 获取数据库名,怎么在服务器建虚机,phpwind9插件,前端框架用得太老旧有什么影响,爬虫餐饮,php 当前域名,石家庄seo外包,springboot动图,网站title标签内容怎么设置,安卓app整站织梦网站源码,html网页源码免费下载,ecshop 模板结构,织梦后台模板调用,html 考勤页面,文件管理系统 开源,java界面小程序lzw

如果觉得《jQuery实现自动滚动到页面顶端办法【jquery】》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。