I have the following script included in my fancybox script:
beforeShow: function () {
var id = this.element.attr("id")
if (id) {
window.location.hash = id;
}
},
beforeClose: function() {
window.location.hash = "";
}
Basically if I open an image with fancybox, the url will change to /#image and when the fancybox window is closed, the url changes to /#. But when this happens, the page scrolls back to the top. Is there any way to avoid this?