diff --git a/app/javascript/packs/vue/navigation/navigator.js b/app/javascript/packs/vue/navigation/navigator.js index c1fe1ec33..92b487f43 100644 --- a/app/javascript/packs/vue/navigation/navigator.js +++ b/app/javascript/packs/vue/navigation/navigator.js @@ -8,7 +8,7 @@ Vue.use(PerfectScrollbar); Vue.prototype.i18n = window.I18n; -window.addEventListener('DOMContentLoaded', () => { +function addNavigationNavigatorContainer() { let navigator = new Vue({ el: '#sciNavigationNavigatorContainer', components: { @@ -55,4 +55,12 @@ window.addEventListener('DOMContentLoaded', () => { }); window.navigatorContainer = navigator -}); +} + +if (document.readyState !== 'loading') { + addNavigationNavigatorContainer(); +} else { + window.addEventListener('DOMContentLoaded', () => { + addNavigationNavigatorContainer(); + }); +} diff --git a/app/javascript/packs/vue/navigation/top_menu.js b/app/javascript/packs/vue/navigation/top_menu.js index bdb2a48ab..d157e0232 100644 --- a/app/javascript/packs/vue/navigation/top_menu.js +++ b/app/javascript/packs/vue/navigation/top_menu.js @@ -8,11 +8,19 @@ Vue.use(PerfectScrollbar); Vue.prototype.i18n = window.I18n; -window.addEventListener('DOMContentLoaded', () => { +function addNavigationTopMenuContainer() { new Vue({ el: '#sciNavigationTopMenuContainer', components: { 'top-menu-container': TopMenuContainer } }); -}); +} + +if (document.readyState !== 'loading') { + addNavigationTopMenuContainer(); +} else { + window.addEventListener('DOMContentLoaded', () => { + addNavigationTopMenuContainer(); + }); +}