您的位置:首页 > 其它

jq 插件编写 待

2014-12-18 10:12 274 查看
<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: