如何让这个下拉菜单在点击二级分类中的a连接后,页面跳转后还是展开状态。
$(function(){varAccordion=function(el,multiple){this.el=el||{};this.multiple=multiple...
$(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().toggleClass('open'); if (!e.data.multiple) { $el.find('.submenu').not($next).slideUp().parent().removeClass('open'); }; } var accordion = new Accordion($('#accordion'), false);});
忘记贴结构了。
<li>
<div class="link">家用分体空调<i class="fontello-icon-angle-down"></i></div>
<ul class="submenu">
<li><a href="/cp/jiayongfentikongdiao/E_MAX7xinpin/">E-MAX7新品</a></li>
<li><a href="/cp/jiayongfentikongdiao/qiliu_/">气流+</a></li>
</ul>
</li> 展开
忘记贴结构了。
<li>
<div class="link">家用分体空调<i class="fontello-icon-angle-down"></i></div>
<ul class="submenu">
<li><a href="/cp/jiayongfentikongdiao/E_MAX7xinpin/">E-MAX7新品</a></li>
<li><a href="/cp/jiayongfentikongdiao/qiliu_/">气流+</a></li>
</ul>
</li> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询