mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
Fixes #8633: Recheck sidenav state on window resize
* Recheck sidenav state on window resize * Remove `data-sidenav-pinned` attribute when hiding sidenav * Remove `data-sidenav-hidden` attribute when showing sidenav
This commit is contained in:
parent
6fe0f4cd7d
commit
c88db77814
@ -139,7 +139,7 @@
|
||||
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
function checkSideNav() {
|
||||
// Check localStorage to see if the sidebar should be pinned.
|
||||
var sideNavRaw = localStorage.getItem('netbox-sidenav');
|
||||
// Determine if the device has a small screeen. This media query is equivalent to
|
||||
@ -154,11 +154,15 @@
|
||||
// jumpy/glitchy behavior on page reloads.
|
||||
document.body.setAttribute('data-sidenav-pinned', '');
|
||||
document.body.setAttribute('data-sidenav-show', '');
|
||||
document.body.removeAttribute('data-sidenav-hidden');
|
||||
} else {
|
||||
document.body.removeAttribute('data-sidenav-pinned');
|
||||
document.body.setAttribute('data-sidenav-hidden', '');
|
||||
}
|
||||
}
|
||||
})();
|
||||
}
|
||||
window.addEventListener('resize', function(){ checkSideNav() });
|
||||
checkSideNav();
|
||||
</script>
|
||||
|
||||
{# Page layout #}
|
||||
|
Loading…
Reference in New Issue
Block a user