0
我正在使用此代码在页面内滚动。基本上,检查内部联系,如果他们是间隔,增加了一个平滑滚动:如何修改jscript以防止滚动的特定链接?
<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 from Bootstrap。此代码与幻灯片冲突,我想禁用此平滑滚动此href
。
如何添加代码来防止这种冲突?
Yesss!谢谢。他们都解决了这个问题。 – www