jq 插件編寫 待

 
<script src="jquery.js" type="text/javascript"></script> 
<script type="text/javascript">


	;(function($){
		//全部方法寫這裏
		var method={
			init : function( options ) {
				//this.text(options.name);
			}, 
			hide : function( ) { 
				this.text(options.name);
			}
		}
		
		$.fn.yybox=function(){// 添加yybox 插件
			// Method calling logic  
			if ( method[method] ) {
				return method[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));  
			} else if ( typeof method === 'object' || ! method ) {
				return method.init.apply( this, arguments );  
			} else {
				$.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );  
			}
		}
	})(jQuery);
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	$(function(){
		$("#id1").on("click",function(){
			$("#id1").yybox({name:'520'})
		})
	})
</script>


<div class="a" id="id1">red</div>
<div style="color:#blue; ">blue</div>
<div style="color:#green; ">green</div>
<div style="color:#yellow; ">yellow</div>


 

發佈了47 篇原創文章 · 獲贊 14 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章