3

When I click a button to submit something it will have a function to show a div

$("body").append('<div class="submitAnimal" style="position: fixed;top: 0;left: 0;bottom: 0;right: 0;background:#000;width: 100%;height: 100%;opacity: 0.32;z-index: 998;"></div>');

I'm trying to use pageshow event on safari (iphone) to hide this div. But it seems to work only one time when using back button.

window.onpageshow = function(event){
    if(event.persisted){
        $('.submitAnimal').hide();
    }
}

then i try to use onpopstate on safari (iphone) to hide this div,and in iphone5S with ios9 it worked,But in iphone6 with ios10 it not worked.

window.onpopstate = function(event) {
    $('.submitAnimal').hide();
};
abagshaw
  • 4,960
  • 3
  • 28
  • 58
howard
  • 31
  • 1

0 Answers0