Browse Source

Add global function to init menu when included remotely

Riccardo Balbo 3 years ago
parent
commit
803d33f058
1 changed files with 6 additions and 2 deletions
  1. 6 2
      layouts/partials/topMenu.html

+ 6 - 2
layouts/partials/topMenu.html

@@ -83,7 +83,7 @@
     
 
     // mark current active item
-    document.addEventListener('DOMContentLoaded', function () {
+    window.initJmeMenu=function () {
         const selectionClass= window.selectedTopMenuClass || "highlightedCl";
 
         const topmenu = document.querySelector('#topmenu');
@@ -127,5 +127,9 @@
         likelyScore.forEach(el=>el.el.classList.remove(selectionClass));
         likelyScore[0].el.classList.add(selectionClass);
 
+    };
+    
+    document.addEventListener('DOMContentLoaded', function(){
+       window.initJmeMenu(); 
     });
-</script>
+</script>