瀏覽代碼

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>