`
erichua
  • 浏览: 510521 次
  • 性别: Icon_minigender_2
  • 来自: 远方
社区版块
存档分类
最新评论

JQuery读书笔记--PLUGIN code模板

阅读更多
自己总结的PLUGIN code模板
/**
 * @author erichua
 */
;
(function($){
	//全局私有变量
	var data;
	
	//公告函数
    $.fn.temp = function(options){
        //函数私有变量
        var data;
        return something;
    };
	//公告属性
    $.fn.temp.data = {};
	//公告函数扩展
    $.fn.temp.dosomething = function(options){
        //函数私有变量
        var data;
		return something;
        
    };
    
    //私有函数
    function doit()
	{};
    
})(jQuery);



另外一种写法
(function($) {
	$.fn.extend({
				lessmore : function(options) {
					return this.each(function() {
								var obj = $(this);
							});
				}
			});
})(jQuery);
1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics