1
我試圖用PathJS,並在控制檯中出現以下錯誤:PathJS - 遺漏的類型錯誤:對象#<Object>沒有方法「默認」(匿名函數)
Uncaught TypeError: Object #<Object> has no method 'default'
(匿名函數)
我用下面的教程:http://mtrpcic.net/2011/02/fragment-uris-theyre-not-as-bad-as-you-think-really/
隨着插件:https://github.com/mtrpcic/pathjs
我的應用程序加載的jQuery然後PathJS插件,然後在app.js此代碼:
$("a").live("click", function(event){
var href = $(this).attr("href");
if(href[0] == "/"){
event.preventDefault();
window.location.hash = "#!" + href;
}
});
Path.default(function(){
$.get(window.location.hash.replace("#!", ""), function(data){
$("#contents").html(data);
});
});
Path.listen();
任何想法,爲什麼我得到的錯誤?
喬希的解決方案是否解決了這個問題? – 2011-07-14 20:06:20