1
我一直試圖在最後幾個小時學習History.js。我創建了三個非常簡單的測試文件,但我似乎無法獲得任何工作。這裏是我的三個文件的內容。如何開始使用history.js?
history.html:
<!doctype html>
<html>
<head>
<title>History Test</title>
<script type="text/javascript" src="jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="jquery.history.js"></script>
<script type="text/javascript" src="history.js"></script>
</head>
<body>
<a href="about.html">about</a>
</body>
</html>
history.js:
$(document).ready(function() {
History.Adapter.bind(window, 'statechange', handleStateChange);
});
function handleStateChange() {
alert("State changed...");
}
about.html:
<!doctype html>
<html>
<head>
<title>About</title>
</head>
<body>
About...
</body>
</html>
當我點擊 '關於' 鏈接,爲什麼不statechange事件火災或我的handleStateChange()函數執行?
嗨外星人,你能把你的完整演示給我嗎?我已經完成了你的教學,但沒有警覺。謝謝 –