本文實例講述了jquery簡單插件制作方法。分享給大家供大家參考,具體如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <script type="text/javascript" src="jquery.js"></script> <title>jquery簡單的插件制作</title> <script type="text/javascript"> (function ( $ ) { $.fn.greenify = function ( options) { var settings = $.extend({ color:"#556b2f", backgroundColor:'#000', padding:'20px' }, options ); return this.css( { color:settings.color, backgroundColor : settings.backgroundColor, padding : settings.padding }); }; }( jQuery )); $(document).ready(function(){ $("div").greenify({ color:"#000", backgroundColor:'#ccc', padding:'50px' }) }); </script></head><body><div id="accordion">jquery簡單的插件制作</div></body></html>
更多關于jQuery相關內容感興趣的讀者可查看本站專題:《jquery中Ajax用法總結》、《jQuery表格(table)操作技巧匯總》、《jQuery拖拽特效與技巧總結》、《jQuery擴展技巧總結》、《jQuery常見經典特效匯總》、《jQuery動畫與特效用法總結》、《jquery選擇器用法總結》及《jQuery常用插件及用法總結》
希望本文所述對大家jQuery程序設計有所幫助。
新聞熱點
疑難解答