【发布时间】:2015-01-04 03:52:57
【问题描述】:
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash;
$target = $(target);
$target.addClass('active');
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 1000, 'swing');
});
HTML 代码
<div style="position: fixed;font-size:15px">
<a href="#header-wrapper">Home</a><br>
<a href="#about">About</a> <br>
<a href="#programme">The System</a><br>
</div>
<div class="title" id="header-wrapper">Content</div>
<div class="title" id="about">Content</div>
<div class="title" id="programme">Content</div>
我已使用此脚本代码来显示视差效果。它在网络上完美运行,但在移动设备上却不行。如何使其在移动设备中工作。请帮忙
【问题讨论】:
标签: jquery