关于jQuery语法的使用
我在网上看到有这种写法:
(function($){
$.fn.任意名称=function(options){
//写方法的具体实现 可以定义一些变量
}
})(jQuery);
调用的时候就是 $("可以是Id或元素或类名").任意名称();
完整例子如下:
(function($){
$.fn.tableUI = function(options){
var defaults = {
evenRowClass:"evenRow",
oddRowClass:"oddRow",
activeRowClass:"activeRow"
}
var options = $.extend(defaults, options);
this.each(function(){
var thisTable=$(this);
//添加活动行颜色
$(thisTable).find("tr").bind("mouseover",function(){
$(this).addClass(options.activeRowClass);
});
$(thisTable).find("tr").bind("mouseout",function(){
$(this).removeClass(options.activeRowClass);
});
});
};
})(jQuery);
上面的这个我还可以看懂 可是下面的这种写法是什么意思 ?
(function(cloudStack, $) {
//里面会定义一些方法
})(cloudStack, jQuery);看不懂这个知道的麻烦给我说一些 谢谢了。。。。。