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()函数执行?
嗨外星人,你能把你的完整演示给我吗?我已经完成了你的教学,但没有警觉。谢谢 –