首页 > 语言 > JavaScript > 正文

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

2024-05-06 14:11:03
字体:
来源:转载
供稿:网友
在公司项目过程中开发过几个插件,下面为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);

官方模板制作手册
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选