1
0
mirror of https://github.com/playit-cloud/support-docs.git synced 2024-11-24 11:06:13 +00:00
support-docs/themes/kiss/static/js/navicon-shift.js
2022-08-29 13:18:51 -07:00

24 lines
704 B
JavaScript

const
nameElement = document.getElementById('nav-name'),
parentElement = document.getElementById('nav-main');
let incremented = 0;
function shiftNavIcons() {
let headingElement = document.getElementById('nav-heading');
if(nameElement.offsetWidth < (headingElement.offsetWidth+10)) {
parentElement.classList.add('nav-shifted');
} else {
incremented++;
if(incremented > 5 && parentElement.offsetWidth > 445) {
parentElement.className = parentElement.className.replace(/\bnav-shifted\b/g, '');
incremented = 0;
}
}
};
window.addEventListener('resize', (event) => {
shiftNavIcons();
});
shiftNavIcons();