diff options
Diffstat (limited to 'static/js/navicon-shift.js')
-rw-r--r-- | static/js/navicon-shift.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/static/js/navicon-shift.js b/static/js/navicon-shift.js new file mode 100644 index 0000000..b87ec9f --- /dev/null +++ b/static/js/navicon-shift.js @@ -0,0 +1,24 @@ +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();
\ No newline at end of file |