<div class="codetitle"> <span><a style="CURSOR: pointer" data="23522" class="copybut" id="copybut23522" onclick="doCopy('code23522')"><u>复制代</u></a></span> 代码如下:</div> <div class="codebody" id="code23522"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja"> <br> <br><meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <br><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <br><title></title> <br></head> <br> <br><input type="button" value="test" id="test"/> <br><script type="text/javascript"> <br>$(function(){ <br>$("#test").hello({ <br>"サイズ":1 <br>}); <br>}); <br></script> <br><script type="text/javascript"> <br>;(function($){ <br>$.fn.hello = function(options){ <br>var defaults = {"size":0}, <br><br>opts = $.extend( {},defaults,options), <br><br>show = { <br>play:function(options){ <br>var _root = this; <br>_root.autoPlay(); (); <br>}, <br>autoPlay:function(){ <br>console.log("auto"); <br>}, <br>eventClick:function(){ <br>//$( "#test").on("click",{show:"dd"},function(e){ <br>// console.log("click :" e.data.show); <br>// }); <br><br>$("#test").on({ <br>click:function(){ <br>alert("click"); <br>}, <br>mouseenter:function (){ <br>alert("enter"); <br>}, <br>mouseleave:function(){ <br>alert("leave"); <br> <br>}; <br>return this.each(function(){ <br>show.play(opts); <br>}); <br></script> <br></body> <br></html> <br><br> </div>