Home  >  Article  >  Web Front-end  >  JQuery plug-in template Friends who make jquery plug-ins can refer to_jquery

JQuery plug-in template Friends who make jquery plug-ins can refer to_jquery

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

Several plug-ins have been developed during the company's project process. The following is the JQuery plug-in template used by Levin. Much the same as on google.

Copy code The code is as follows:

; (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);

Official template production manual
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