From afc40d9ccad8c2d3a684917f362525c2de44d0f1 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Tue, 28 May 2024 13:50:55 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B02039=20-=20Fix=20newsroom=20menu=20not?= =?UTF-8?q?=20opening=20due=20to=20regression=20in=20a642ad6d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/components/newsroom-menu.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/components/newsroom-menu.js b/js/components/newsroom-menu.js index a03b6ac4d..a3167d5dc 100644 --- a/js/components/newsroom-menu.js +++ b/js/components/newsroom-menu.js @@ -43,9 +43,14 @@ $(function() { var me = this; + // Check if popover menu is already initialized + if ($(this.js_selectors.menu_toggler).hasClass('ibo-is-loaded') === true) { + return; + } + // Important: For now, the popover menu is manually instantiated even though the PHP NewsroomMenu class inherits PopoverMenu because the jQuery widget doesn't. We might refactor this in the future. $(me.element).popover_menu({'toggler': this.js_selectors.menu_toggler}); - $(this.js_selectors.menu_toggler).off('click').on('click', function (oEvent) { + $(this.js_selectors.menu_toggler).on('click', function (oEvent) { var oEventTarget = $(oEvent.target); var aEventTargetPos = oEventTarget.position(); var aEventTargetOffset = oEventTarget.offset();