我在网站上使用的是Bootstrap 3传送带。我也在使用这个jQuery脚本:
<script>
$(function() {
$('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;
}
}
});
});
</script>
问题是,在滑动转盘时,它会单击#carousel
链接。这使转盘无法正常工作。
我想知道的是,是否可以#carousel
从脚本中排除?因此,该脚本不适用于#carousel
,但适用于所有其他链接。
谢谢你。
只需将其添加到选择器
$('a[href*=#]:not([href=#]):not([href=#carousel])')
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句