我下载了一个基于HTML的模板来创建一个静态网站。我更换了所有的内容,我需要添加在我的网站。
当我在本地系统中运行index.html文件时,它正常工作。上传到服务器- puneetchawla.com之后
当第一次网站打开,它的工作正常。但是当我点击菜单栏时,它会打开页面,在域名后面加上'#‘。
例如。
http://puneetchawla.com/#resume.html这个“#”不显示,也不会出现在我的本地系统中。它只显示当我上传网站到服务器。我不知道为什么“#”会来。它不应该来。
我无法理解需要与您共享的代码。我可以分享你想要的代码。给我解释一下“#”出现的原因,以及我如何摆脱它。
发布于 2015-07-31 17:11:18
在查看Chrome中的美化版本时,190 of Template.js定义了行为。
_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"))
},发布于 2015-07-31 17:08:55
您的Template.js中包含以下代码(我在第1行第3675列找到它):
$(b,a).click(function(a){a.which>1||a.ctrlKey||(a.preventDefault(),document.location.hash="#"+$(this).attr("href"))})这是获取链接的href,并在单击链接时将#放在它们的前面。
https://stackoverflow.com/questions/31751223
复制相似问题