Skip to content

Commit

Permalink
fix: allow multiple megamenus in the same page bny using $.closest()…
Browse files Browse the repository at this point in the history
  • Loading branch information
ffoodd committed Jul 1, 2019
1 parent 0657ba1 commit 066ebc0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/src/o-megamenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 066ebc0

Please sign in to comment.