Blogger Information
Blog 27
fans 0
comment 0
visits 43705
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
html中页面跳转到指定位置的三种方式
xingzhi的博客
Original
5127 people have browsed it

html中页面跳转到指定位置的三种方式

实例

$("#sl").on('tap', function(e) {
			    //方式一
			    window.location.hash="#sucaiLocal";    //点击后地址栏url会在原来url后边加上#bottombox,再次点击没有反应
			    
			    //方式二
		            var bottombox = document.getElementById("sucaiLocal");
			    bottombox.scrollIntoView();  //点击后地址栏url不会变化,可多次点击
                           
                            //方式三
			   $("html, body").animate({   //点击后地址栏url会在原来url后边加上#bottombox,再次点击没有反应
			       	scrollTop: $("#sucaiLocal").offset().top 
			    }, {
			    	duration: 500,easing: "swing"
			    });
			    return false;
			});

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post