【发布时间】:2011-12-20 16:45:26
【问题描述】:
我试图在我的网站上包含流沙脚本,但我失败了。
Firebug 给了我这个错误:65 Uncaught TypeError: Cannot call method 'split' of undefined:
对于这个脚本:
jQuery.noConflict();
jQuery(document).ready(function($){
// Clone applications to get a second collection
var $data = $("#portfolio-items").clone();
//NOTE: Only filter on the main portfolio page, not on the subcategory pages
$('#portfolio-terms ul li').click(function(e) {
$("ul li").removeClass("active");
// Use the last category class as the category to filter by. This means that multiple categories are not supported (yet)
var filterClass=$(this).attr('class').split(' ').slice(-1)[0];
jquery.custom.js:65 Uncaught TypeError: Cannot call method 'split' of undefined (repeated 6 times)
if (filterClass == '.all current') {
var $filteredData = $data.find('#portfolio-');
} else {
var $filteredData = $data.find('#portfolio-[data-type=' + filterClass + ']');
}
$("#portfolio-items").quicksand($filteredData, {
duration: 800,
easing: 'swing',
});
$(this).addClass("active");
return false;
});
});
见这里:http://stakk.it/
错误是什么?
谢谢你,对不起我的英语不好!
【问题讨论】:
-
您为什么认为 filterClass 可能等于
.all current?
标签: jquery