Jan*_*nis 1 variables jquery arguments function argument-passing
我之前遇到过这个问题几次,所以这一次我想我会从那些了解得更好的人那里得到一些建议.
我基本上想在我function( argument )的函数中使用my 作为函数名.
这是我尝试使用的一些代码:
$.fn.moveTo = function( myAction ) {
$(this).myAction().fadeIn(400);
};
$('.currentElement').moveTo( 'next' ); // should become: $(this).next().fadeIn(400);
$('.currentElement').moveTo( 'prev' ); // should become: $(this).prev().fadeIn(400);
Run Code Online (Sandbox Code Playgroud)
关于如何让它运行的任何想法?
谢谢.