From 066ebc0132c934c36432e76faebd41669179f370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Poupard?= Date: Mon, 1 Jul 2019 14:51:50 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20allow=20multiple=20megamenus=20in=20the?= =?UTF-8?q?=20same=20page=20bny=20using=20$.closest()=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/src/o-megamenu.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/src/o-megamenu.js b/js/src/o-megamenu.js index c1c6936d2b..47ba5cf218 100644 --- a/js/src/o-megamenu.js +++ b/js/src/o-megamenu.js @@ -141,7 +141,7 @@ class MegaMenu { const rootPosition = $('.mega-menu-panel .nav-link').first().parents().index($('.mega-menu')) const translatePercentage = -(position - rootPosition) * PERCENTAGE / 2 const $thisNav = $target.closest(Selector.NAV_MENU) - const $rootNav = $(Selector.ROOT_NAV) + const $rootNav = $target.closest(Selector.ROOT_NAV) $rootNav.addClass(ClassName.TRANSITIONING) @@ -230,7 +230,7 @@ class MegaMenu { const $this = $(e.target) const $thisNav = $this.closest(Selector.NAV_MENU) const $targetNav = $this.next(Selector.NAV_MENU) - const $rootNav = $(Selector.ROOT_NAV) + const $rootNav = $this.closest(Selector.ROOT_NAV) const $thisNavToggler = $this const currentTranslatePos = parseInt($rootNav.css('transform').split(',')[SPLITLENGHT], 10) const navWidth = $rootNav.width() @@ -285,7 +285,7 @@ class MegaMenu { const $this = $(e.target) const $thisNav = $this.closest(Selector.NAV_MENU) const $targetNav = $thisNav.parent().closest(Selector.NAV_MENU) - const $rootNav = $(Selector.ROOT_NAV) + const $rootNav = $this.closest(Selector.ROOT_NAV) const $targetNavToggler = $targetNav.find(Selector.NAV_LINK_EXPANDED) const currentTranslatePos = parseInt($rootNav.css('transform').split(',')[SPLITLENGHT], 10) const navWidth = $rootNav.width()