绠€璁?jQuery 鎻掍欢妯℃澘
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了绠€璁?jQuery 鎻掍欢妯℃澘相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%96%87%e4%bb%b6' title='鏂囦欢'>鏂囦欢 杩斿洖缁撴灉 lis UNC 甯冨皵 author plugin todo 浠g爜
1 /** 2 * @lisence jquery plugin demo v1.0.0 3 * 4 * author: Jeremy Yu 5 * 6 * description: 7 * this is a jquery plugin Template 8 * see the end of this document to learn how to use the jquery plugin 9 */ 10 ; 11 (function($, window, document, undefined) 12 13 /* 鎻掍欢绫诲畾涔?*/ 14 var PluginName = function(el, options) 15 this.version = "1.0.0" 16 this.el = el; 17 this.options = options; 18 this.init(); //璋冪敤鍒濆鍖栨柟娉?/span> 19 20 21 /* 瀹氫箟鏃犲弬鏂规硶,鏂规硶鍚嶄负 init */ 22 PluginName.prototype.init = function() 23 /* 鍒濆鍖栨搷浣?*/ 24 alert(鈥樺垵濮嬪寲鎴愬姛鈥?span style="color: #000000;">); 25 26 27 /* 瀹氫箟鏈夊弬鏂规硶,鏂规硶鍚嶄负 func */ 28 PluginName.prototype.func = function(arg) 29 /* TODO */ 30 31 32 /* 瀹氫箟鏈夎繑鍥炲€兼柟娉?鏂规硶鍚嶄负 funcRet */ 33 PluginName.prototype.funcRet = function() 34 /* TODO 35 * 鎵ц瀹屽悗杩斿洖缁撴灉 36 * 杩斿洖鍊煎彲浠ユ槸undefined銆乶ull銆佹暟瀛椼€佸瓧绗︿覆銆佸竷灏斿€笺€佸璞$瓑 37 * 濡傛灉娌℃湁杩斿洖锛岄粯璁よ繑鍥?undefined 38 */ 39 return 0; 40 41 42 /* 瀹氫箟鍛藉悕绌洪棿锛屼笖浣滀负data鐨刱ey */ 43 var namespace = 鈥榩lugin_name鈥?span style="color: #000000;">; 44 /* 瀹氫箟鎻掍欢 */ 45 $.fn.plugin_name = function(options) 46 var $this = $(this); 47 var value, args = Array.prototype.slice.call(arguments, 1); 48 var data = $this.data(namespace); 49 if (!data) 50 var settings = $.extend(, $.fn.plugin_name.defaults, options); 51 $this.data(namespace, data = new PluginName(this, settings)); 52 53 if (typeof options == 鈥榮tring鈥?span style="color: #000000;">) 54 value = data[options].apply(data, args); 55 56 return typeof value === 鈥榰ndefined鈥?? this : value; 57 ; 58 59 /* 瀹氫箟鎻掍欢鐨勯粯璁ゅ€?灞炴€с€佷簨浠? */ 60 $.fn.plugin_name.defaults = 61 prop1: "", 62 prop2: "", 63 onEvent: function(arg1, arg2) , 64 onError: function(err) 65 ; 66 67 68 /* 69 寮曞叆 jquery.min.js 鍜?褰撳墠 js 鏂囦欢 70 71 html浠g爜锛? 72 <div id="#plugin"></div> 73 74 鎻掍欢浣跨敤 75 $(鈥?plugin鈥?.plugin_name( prop1 : 鈥樷€? onEvent : function()); 76 77 鏂规硶璋冪敤 78 $(鈥?plugin鈥?.plugin_name(鈥榝unction_name鈥? args); 79 */ 80 81 )(jQuery, window, document);
以上是关于绠€璁?jQuery 鎻掍欢妯℃澘的主要内容,如果未能解决你的问题,请参考以下文章
fullPage鏁欑▼ -- 鏁村睆婊氬姩鏁堟灉鎻掍欢 fullpage璇﹁В
JQuery/JS鎻掍欢 jsTree鍔犺浇鏍戯紝鍒濆鍖栨椂鍔犺浇鍓嶄笁绾ц妭鐐癸紝褰撳睍寮€绗笁绾ц妭鐐规椂 灏卞姞杞借鑺傜偣涓嬬殑鎵€鏈夊瓙鑺傜偣