我在 Wordpress 网站上使用插件 Popups for Divi。
我想在点击浏览器后退按钮时关闭模式(我特别需要手机)。我尝试使用下面的 Js 代码,但没有成功。
<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>