问题
Firstly: I ma very new in jQuery and web front-end.
Problem: I have a test site
Steps to see the problem:
- Click on [UploadTest]
- Click on any pic in gallery to see an overlay
- Click on browser's Back button
Now I see main page with the overlay. Question is how to hide overlay when I leave the gallery page by Back button?
Sometime othe overlay is hidden but when I go on gallery page again it is visible.
How to hide it automatically?
Thanks.
UPDATE: Sorry, I can not post sources because I do not know where is problem. Please if you have a minute look inside sources in browser.
回答1:
$(document).ready(function () {
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
$("#galleryOverlay").css('display', 'none')
});
}
});
来源:https://stackoverflow.com/questions/23760625/how-to-hide-overlay-pressing-back-button