jiangzeyin_通过本文主要向大家介绍了onpopstate,popstate等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
这里用另一种方案来实现
window.setTimeout(function() {
var m=4;
backfun(m);
window.onpopstate = function() {
m--;
if(m==3){
$(".dd").slideDown();
$(".mask").show();
$("body").on("touchmove",function(event){
event.preventDefault;
}, false);
}else if(m==2){
window.location.href="/dx1sh_back.html";
}
backfun(m);
};
function backfun(m){
//console.log(m);
history.pushState(null, null, "#tuit"+m);
}
},1000);
onpopstate api 文档如下 https://developer.mozilla.org/zh-CN/docs/Web/API/Window/onpopstate
此方法可以适用于ios 浏览器侧滑返回事件