为了清理我的代码,我想在我的实际jQuery插件中使用子插件,但实际上没有任何事情发生。 THX提前在jQuery插件中调用其他插件
作为一个简单的例子,请看看下面的代码:
(function($){
$.fn.funct = function() {
// so far it seems to run the code...
console.log('funct is running...');
return this.each(function(){
// ...but nothing is happening here
console.log('this.each is running...');
$(this).css('background', 'blue');
}
}
$.fn.foo = function() {
return this.each(function(){
console.log('plugin is running...');
$(this).funct();
});
};
})(jQuery);
哇,好赶上! – 2009-08-06 13:26:57