jQuery插件

1.jQuery插件分類

  • 封裝對象方法的插件jquery

應用最廣api

  • 封裝全局函數的插件函數

做爲jQuery全局函數插件插件

  • 選擇器插件code

做爲jQuery選擇器的補充對象

2.jQuery插件編寫方法

封裝對象方法的插件get

(function($){
    $.fn.extend({                          //注意此處是fn
        "pluginName":function(arguments){
            //plugin code goes here.
        },
        "anotherPluginName":...
    });
})(jQuery);

插件寫好後方可調用io

封裝全局函數的插件function

(function($){
    $.extend({                          
        "pluginName":function(arguments){
            //plugin code goes here.
        },
        "anotherPluginName":...
    });
})(jQuery);

選擇器插件plugin

同封裝全局函數的插件寫法

3.獲取網上的jQuery插件

網址:http://plugins.jquery.com使用方法:參考插件api

相關文章
相關標籤/搜索