Преглед изворни кода

Add global function to init menu when included remotely

Riccardo Balbo пре 3 година
родитељ
комит
803d33f058
1 измењених фајлова са 6 додато и 2 уклоњено
  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>