/* * jquery.accordion 0.0.1 * copyright (c) 2015 lengziyu http://lengziyu.com/ * date: 2015-10-10 */ ;(function($){ $.fn.accordion = function(opts){ //默认值 var defaults = { max: "377px", min: "62px", speed: "1000" } var opts = $.extend(defaults, opts); this.each(function(){ var t = $(this), m = t.children(), c = m.children(); //触发事件 m.find(".active b").hide(); m.on("mouseenter","li",function(){ $(this).addclass('active') .animate({width:opts.max},opts.speed) .find("b").fadeout() .parent().siblings().removeclass('active') .animate({width:opts.min},opts.speed) .find("b").show(); }) }) } })(jquery);