1.給a標(biāo)簽添加一個(gè)統(tǒng)一的類(lèi)名anchor(可自定義)
//html
<a class="anchor" href="#gsxx" rel="nofollow">工商信息</a>
<div id="gsxx">工商信息</div>
//jquery
$(".anchor").bind("click touch",function(){
//根據(jù)a標(biāo)簽的href轉(zhuǎn)換為id選擇器横辆,獲取id元素所處的位置
$('html,body').animate({scrollTop: ($($(this).attr('href')).offset().top)},300);
});