jquery插件编写
4 /*(function($) { 5 $.fn.accordion = function(options) { 6 var settings = $.extend({}, {open: false}, options); 7 return this.each(function() { 8 var dts = $(this).children('dt'); 9 dts.click(onClick); 10 dts.each(reset); 11 if(settings.open) $(this).children('dt:first-child').next().show(); 12 }); 13 14 function onClick() { 15 $(this).siblings('dt').each(hide); 16 $(this).next().slideDown('fast'); 17 return false; 18 } 19 20 function hide() { 21 $(this).next().slideUp('fast'); 22 } 23 24 function reset() { 25 $(this).next().hide(); 26 } 27 } 28 })(jQuery); 29 */