Home  >  Article  >  Web Front-end  >  JQuery 插件模板 制作jquery插件的朋友可以参考下_jquery

JQuery 插件模板 制作jquery插件的朋友可以参考下_jquery

WBOY
WBOYOriginal
2016-05-16 18:32:05843browse

在公司项目过程中开发过几个插件,下面为Levin所用的JQuery插件模板。和google上的大同小异哈。

复制代码 代码如下:

; (function($) {
// Private functions.
var p = {};
p.func1 = function() { };
//main plugin body
$.fn.PLUGIN = function(options) {
// Set the options.
options = $.extend({}, $.fn.PLUGIN.defaults, options);

// Go through the matched elements and return the jQuery object.
return this.each(function() {
});
};
// Public defaults.
$.fn.PLUGIN.defaults = {
property: 'value'
};
// Public functions.
$.fn.PLUGIN.method1 = function(skinName) {
return;
};
})(jQuery);

官方模板制作手册
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn