Commit 61b85a58 authored by Eugen Rochko's avatar Eugen Rochko

Improve script

parent feca9ba8
Pipeline #314 passed with stages
in 17 seconds
(function () {
document.addEventListener('DOMContentLoaded', function () {
var menuLinks = document.getElementsByClassName('menu-item');
for (var i = 0; i < menuLinks.length; i++) {
menuLinks[i].addEventListener('click', toggleSubMenu, false);
}
'use strict';
function onLoaded () {
function toggleSubMenu () {
var subMenus = document.getElementsByClassName('sub-menu');
......@@ -15,5 +11,17 @@
this.parentNode.querySelector('.sub-menu').classList.remove('collapsed');
}
});
var menuLinks = document.getElementsByClassName('menu-item');
for (var i = 0; i < menuLinks.length; i++) {
menuLinks[i].addEventListener('click', toggleSubMenu, false);
}
}
if (document.readyState === 'interactive' || document.readyState === 'complete') {
onLoaded();
} else {
document.addEventListener('DOMContentLoaded', onLoaded);
}
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment