mirror of
https://github.com/playit-cloud/support-docs.git
synced 2024-11-24 11:06:13 +00:00
24 lines
704 B
JavaScript
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(); |