Prechádzať zdrojové kódy

Add global function to init menu when included remotely

Riccardo Balbo 3 rokov pred
rodič
commit
803d33f058
1 zmenil súbory, kde vykonal 6 pridanie a 2 odobranie
  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>