0
:#标签会导致页面滚动到我已经包含在我的fancybox脚本以下脚本顶部
beforeShow: function() {
var id = this.element.attr("id")
if (id) {
window.location.hash = id;
}
},
beforeClose: function() {
window.location.hash = "";
}
基本上,如果我打开使用的fancybox的图像时,URL将变为/#图像当的fancybox窗口关闭后,网址将更改为/#。但是,当发生这种情况时,页面会滚动回顶部。有什么办法可以避免这种情况?
退房这个问题:http://stackoverflow.com/questions/645202/can-i-update-window-location-hash-without-having-the -web-page-scroll – LeonardChallis