【发布时间】:2011-06-07 01:05:02
【问题描述】:
我正在尝试使用 PathJS,并在控制台中收到以下错误:
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();
任何想法为什么我会收到错误?
【问题讨论】:
-
Josh 的解决方案是否解决了这个问题?
标签: jquery jquery-plugins path.js