具体效果参考:http://www.zhangxinxu.com/study/201306/ajax-page-html5-history-api.html?

//以下是自己的部分理解
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="description" content="HTML5 history API与ajax分页 » 张鑫旭-鑫空间-鑫生活"/>
<meta name="description" content="张鑫旭web前端学习实例页面 HTML5 history API与ajax分页"/>
<meta name="keywords" content="ajax, 分页, html5, history, API"/>
<meta name="author" content="张鑫旭, zhangxixnu"/>
<title>HTML5 history API与ajax分页 » 张鑫旭-鑫空间-鑫生活</title>
<link rel="stylesheet" href="../css/demo.css" type="text/css"/>
<link rel="stylesheet" href="../css/hl.css" type="text/css"/>
<link rel="stylesheet" href="../css/zxx.lib.css" type="text/css"/>
</head>

<body>
<div )[1] === query) { ///eleTarget === null 在第二次调用时起作用,

eleTarget = this;
}
});

if (!eleTarget) {
history.replaceState(null, document.title, location.href.split("?")[0]+"#"+location.hash);
fnHashTrigger();
} else {
$(eleTarget).trigger("click");
}
}
};
//初始载入时 history.pushState 不为空
if (history.pushState) {
window.addEventListener("popstate", function () { //popstate 点击浏览器的前进后台 、或者调用history。go(back)时触发该事件
fnHashTrigger();
});
// 默认载入
//alert("00");
fnHashTrigger(); //初始载入时调用
// alert(3);
}
</script>

</body>
</html>

相关文章:

  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案