900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > jQuery操作锚点动态位移

jQuery操作锚点动态位移

时间:2022-01-22 15:34:48

相关推荐

jQuery操作锚点动态位移

web前端|js教程

jQuery,位移,操作

web前端-js教程使用jQuery animate()方法实现页面平滑滚动特效

php高端工作室源码,vscode前端插件推荐,Ubuntu老花屏,tomcat 平滑升级,sqlite运行速度慢,爬虫软件收集终端信息是干嘛的,php 字符串 遍历,南平有效的seo介绍,免费个人博客网站模板,中国恋模板下载地址lzw

$(html, body).animate({scrollTop: $(hash).offset().top}, 800, function(){window.location.hash = hash;});

简单实例代码:

折叠网页源码,vscode调试显示数组,ubuntu有桌面,电脑运行tomcat死机,爬虫303,php 微信 会员,提高seo排名品牌,淡蓝色大气门户网站,phpcms 添加新模板lzw

$(document).ready(function(){ // Add smooth scrolling to all links $("a").on(click, function(event) { // Make sure this.hash has a value before overriding default behavior if (this.hash !== "") { // Prevent default anchor click behavior event.preventDefault();// Store hash var hash = this.hash;// Using jQuerys animate() method to add smooth page scroll // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area $(html, body).animate({ scrollTop: $(hash).offset().top }, 800, function(){ // Add hash (#) to URL when done scrolling (default click behavior) window.location.hash = hash; }); } // End if });}); body, html, .main { height: 100%;} section { min-height: 100%;}点击此处平滑滚动到第二部分

分享平台 源码,ubuntu更新软件ssh,网络爬虫提倡吗,PHP入门到精通教程百度网盘,seo视频首页lzw

SECTION 2

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