gpt4 book ai didi

javascript - 为什么 # 出现在 URL 中

转载 作者:太空宇宙 更新时间:2023-11-04 11:36:01 24 4
gpt4 key购买 nike

我下载了一个基于 HTML 的模板来创建一个静态网站。我替换了我需要在我的网站中添加的所有内容。

当我在本地系统中运行 index.html 文件时,它可以正常工作。上传到服务器后 - puneetchawla.com

当第一次打开网站时,它工作正常。但是,当我单击菜单栏时,它会打开页面,并在页面名称之前的域名之后添加“#”。

例如

http://puneetchawla.com/#resume.html

此“#”不显示或出现在我的本地系统中。它仅在我将网站上传到服务器时显示。我不知道为什么会出现“#”。它不应该来。

我无法理解我需要与您分享哪些代码。我可以分享你想要的代码。解释一下 '#' 出现的原因以及如何摆脱它。

最佳答案

当在 Chrome 中查看美化版本时,该行为在 Template.js190 行中定义。

_initAjaxPagesLoading: function(a, b) {
a && !this.menu.isFileProtocol() && (b || (b = "a"),
$(b, a).click(function(a) {
a.which > 1 || a.ctrlKey || (a.preventDefault(),
document.location.hash = "#" + $(this).attr("href"))
}
))
},

删除该函数及其在第 88 和 98 行的引用:

initBlog: function() {
// Remove this:
this._initAjaxPagesLoading($("section.blog"))
},
initPortfolio: function() {
$(".page-portfolio__item").each(function() {
$(this).hoverdir({
hoverDelay: 50
})
}
),
// Remove this:
this._initAjaxPagesLoading($("section.page-portfolio"))
},

关于javascript - 为什么 # 出现在 URL 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31751223/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com