0

I'm using the plugin Popups for Divi on a Wordpress website.

I want to close the modal on click of browser back button (I need that especially for mobiles). I tried using the Js code below, but it didn't work.

<script type="text/javascript">
 $(document).ready(function(){
  var openModalHashStateId = "#modalOpen";
  $('#myPopup').on('DiviPopup.show', function(event) {
  window.location.hash = openModalHashStateId;
  });
  $('#myPopup').on('DiviPopup.hide', function(event) {
  window.history.back();
  });
})
</script>
Devang
  • 454
  • 1
  • 8
  • 18

0 Answers0