jquery自定义插件 demo 2016-1-13
只是一个简易的示例
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $.fn.portamento = function(options) { var opts = $.extend({}, $.fn.portamento.defaults, options); var panel = this; var gap = opts.gap; var aaaaaa = opts.aaaaaa; console.log(aaaaaa); console.log(gap); }; $.fn.portamento.defaults = { ‘wrapper‘ : $(‘body‘), ‘gap‘ : 10, ‘disableWorkaround‘ : false }; $("#div1").portamento({aaaaaa: "a1a1a1a1",gap:"MMMMMMMMMMM"}); }); </script> <style type="text/css"> #div1{border:1px solid #f00;} </style> <div id="div1">sdsdsdsdsdsdsdsdsdsdsdsdsd</div>
..
时间: 2024-10-13 01:14:10