JQuery 插件模板 制作jquery插件的朋友可以参考下
作者:bea
在公司项目过程中开发过几个插件,下面为Levin所用的JQuery插件模板。和google上的大同小异哈。 代码如下: ; (function($) { // Private functions. var p = {}; p.func1 = function() { }; //main plugin body $.fn.PLUGIN = function(options) { // Set the options. options = $.extend({},
在公司项目过程中开发过几个插件,下面为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);
官方模板制作手册
有用 | 无用
代码如下:
; (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);
官方模板制作手册
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- Jquery AutoComplete自动完成 的使用方法实例
- JavaScript 对象的属性和方法4种不同的类型
- jQuery 前的按键判断代码
- Javascript 匿名函数及其代码模式原理
- JS 有名函数表达式全面解析
- Jquery Ajax学习实例6 向WebService发出请求,返回DataSet(XML) 异步调用
- JavaScript 高效运行代码分析
- JS setCapture 区域外事件捕捉
- javascript 实现滚动效果代码整理
- JavaScript 无缝上下左右滚动加定高定宽停顿效果(兼容ie/ff)
- 小议Javascript中的this指针
- js实现的类marquee水平循环滚动
- js 把字符串当函数执行的方法
- jQuery each()方法的使用方法
- jQuery each()小议
- jquery ajax执行后台方法
- jQuery中与toggleClass等价的程序段 以及未来学习的方向
- javascript 验证日期的函数
- 12个非常有创意的JavaScript小游戏