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