0
我正在使用Bootstrap,並且常規導航當前使用平滑滾動腳本進入頁面的各個部分。平滑滾動後關閉模態達到錨
對於手機,我有一個全屏導航模式,一旦你點擊漢堡圖標就會打開。它也將使用平滑滾動,但是我似乎無法讓模式關閉,只要您點擊菜單中的鏈接並將其帶到該部分。
腳本
$(function() {
$('a[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;
}
}
});
$('#myModal').modal('hide');
});
我想通了錯誤。我剛添加它在菜單滾動後立即觸發。所以就在退貨聲明之前。 – peyton98