求解 jquery.x=function(a,b,c,d,event){}
理解方法的意思,但是不理解为什么可以这么写。
例如:
jQuery.fold = function(obj,obj_c,speed,obj_type,Event){
if(obj_type == 2){
$(obj+":first").find("b").html("-");
$(obj_c+":first").show();
}
$(obj).on(Event,function(){
if($(this).next().is(":visible")){
if(obj_type == 2){
return false;
}else{
$(this).next().slideUp(speed).end().removeClass("selected");
if($(this).find("b")){
$(this).find("b").html("+");
}
}
}
else{
if(obj_type == 3){
$(this).next().slideDown(speed).end().addClass("selected");
if($(this).find("b")){
$(this).find("b").html("-");
}
}else{
$(obj_c).slideUp(speed);
$(obj).removeClass("selected");
if($(this).find("b")){
$(obj).find("b").html("+");
}
$(this).next().slideDown(speed).end().addClass("selected");
if($(this).find("b")){
$(this).find("b").html("-");
}
}
}
});
}
这是给jQuery拓展方法吧。
jquery.x=function(a,b,c,d,event){}就是拉姆达表达式,
函数里面就是各种判断加DOM操作啊