$(function() { var Accordion = function(el, multiple) { this.el = el || {}; this.multiple = multiple || false; // Variables privadas var links = this.el.find('.link'); // Evento links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown) } Accordion.prototype.dropdown = function(e) { var $el = e.data.el; $this = $(this), $next = $this.next(); $next.slideToggle(); $this.parent().siblings().removeClass("open"); $this.parent().toggleClass('open'); $this.parent().siblings().removeClass("imgRotate"); $this.parent().toggleClass('imgRotate'); if (!e.data.multiple) { $el.find('.submenu').not($next).slideUp().parent().removeClass('open'); }; } var accordion = new Accordion($('#accordion'), false); // 項目添加 var Accordion1 = function(el, multiple1) { this.el = el || {}; this.multiple1 = multiple1 || false; // Variables privadas var links1 = this.el.find('.aa'); // Evento links1.on('click', {el: this.el, multiple1: this.multiple1}, this.dropdown) } Accordion1.prototype.dropdown = function(e) { var $el = e.data.el; $this = $(this), $next = $this.next(); $next.toggle(); $this.parent().toggleClass('curLI'); if (!e.data.multiple1) { $el.find('.fileLIST').not($next).parent().removeClass('curLI'); }; } var accordion = new Accordion1($('.resultList'), false); });