$('.top-menu-list').on('click', 'a', function(e) { var $this = $(this) if ($this.next().length > 0) { $this.closest('.top-menu-list').addClass('active') $this.next().addClass('active').parent().siblings().find('.active').removeClass('active') } if ($this.find('.icon-left').length > 0) { $this.closest('.top-menu-list').removeClass('active') } }) $(".dropdown-toggle").on("click", '[data-stopPropagation]', function(e) { e.stopPropagation(); e.preventDefault(); }) $(".dropdown-toggle").on("mouseenter", function() { $(this).dropdown("toggle"); }) if($('.menu-list').length>0){ $('.menu-list').on('click', '.item>a', function (e) { if ($(this).parent().find('.cell a').length > 0) { e.stopPropagation(); e.preventDefault(); var $li = $(this).closest('li'); if ($li.hasClass('active')) { $li.removeClass('active') } else { $li.addClass('active').siblings('.active').removeClass('active') } } }) }