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