【发布时间】:2013-10-09 05:08:26
【问题描述】:
我在页面中尝试平滑滚动时遇到了一些问题,基本上我在页面周围有这样的锚标签:
<li><a href="#description">Module Description</a></li>
...
<section id=" description ">
我正在使用以下运行良好的 javascript,但问题是,如果我使用此脚本,bootstrap 3 的模式和其他功能会中断并且不再工作
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
我想知道这个脚本有什么解决方案,或者还有其他类似的脚本用 bootstrap 3 测试过 谢谢
【问题讨论】:
标签: javascript jquery twitter-bootstrap twitter-bootstrap-3