gpt4 book ai didi

jquery - Window.location.hash 需要语法帮助

转载 作者:行者123 更新时间:2023-12-03 22:41:02 25 4
gpt4 key购买 nike

我的网站位于 http://visualise.ca/当您通过单击缩略图加载帖子时,它将使用 ajax 在页面中加载帖子。当您关闭帖子时,它会使用此代码将网址更改回 http://visualise.ca/无需重新加载页面:

$("#close").live("click", function(event) {
$("#board").fadeOut("slow");
$("#board-wrapper").slideUp("slow");
$("html,body").delay(1000).animate({scrollTop: 0}, 300);
window.location.hash = "";
window.history.pushState(null,null,site_url+"/");
return false;
});

但在 IE8 中它又改回 http://visualise.ca/#而不是http://visualise.ca/ 。有没有办法纠正这个问题并确保将其更改为 http://visualise.ca/

最佳答案

这不会阻止吗?

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(document).ready(function() {
$(".testPhoto").click(function(event){
event.stopPropagation();
alert("do something");
return false;
});
});
</script>
<a class="testPhoto" href="#testPhoto" onclick="testPhoto">Test Photo</a>

关于jquery - Window.location.hash 需要语法帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7196974/

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