我已经做了一个小的函数,我将在应用程序中重复使用几次。这似乎是我写的语法错误,因为我的控制台显示一个错误“对象[对象对象]没有方法'fadeIt'jQuery将对象从一个函数传递到另一个函数
所以我想这个问题是传递一个函数的对象到另一个..不是知道如何做到这一点优雅。我的代码如下。
感谢您的帮助!
http://jsfiddle.net/danielredwood/aFx6u/2/
function fadeIt() {
$(this).animate({
opacity:0
}, 400, function(){
//$(this).css('cursor','auto');
//$(this).children('img').css('margin-left','-100px');
});
}
$('.box').click(function(){
$(this).fadeIt();
}):
为什么不直接使用jQuery的'淡出()'函数? – rjz 2012-03-04 01:51:34
这将帮助你解决它:http://docs.jquery.com/Plugins/Authoring – nnnnnn 2012-03-04 01:53:16
@rjz - 将结合一些其他的好东西,评论是。 – technopeasant 2012-03-04 01:56:32