我用 Bootstrap 创建了一个站点,其中包含两个页面:
index.html
印象.html
我想在 index.html 中使用页面跳转,并从 impressum 访问这些页面跳转。这工作正常,但只要我点击从 impressum.html 跳转的页面,它就会停留在 URL 中并且不会消失。
我用 Bootstrap 创建了一个站点,其中包含两个页面:
index.html
印象.html
我想在 index.html 中使用页面跳转,并从 impressum 访问这些页面跳转。这工作正常,但只要我点击从 impressum.html 跳转的页面,它就会停留在 URL 中并且不会消失。
你可以像这样使用一点 JavaScript:
function clearHash(){
var uri = window.location.toString();
if (uri.indexOf("#") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("#"));
window.history.replaceState({}, document.title, clean_uri);
}
}
然后在滚动事件上触发Function:
$(window).scroll(function(){
clearHash();
});
(我假设您因为 Bootstrap 而使用 JQuery)