mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-20 19:19:22 -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>
|
<body>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function() {
|
function checkSideNav() {
|
||||||
// Check localStorage to see if the sidebar should be pinned.
|
// Check localStorage to see if the sidebar should be pinned.
|
||||||
var sideNavRaw = localStorage.getItem('netbox-sidenav');
|
var sideNavRaw = localStorage.getItem('netbox-sidenav');
|
||||||
// Determine if the device has a small screeen. This media query is equivalent to
|
// Determine if the device has a small screeen. This media query is equivalent to
|
||||||
@ -154,11 +154,15 @@
|
|||||||
// jumpy/glitchy behavior on page reloads.
|
// jumpy/glitchy behavior on page reloads.
|
||||||
document.body.setAttribute('data-sidenav-pinned', '');
|
document.body.setAttribute('data-sidenav-pinned', '');
|
||||||
document.body.setAttribute('data-sidenav-show', '');
|
document.body.setAttribute('data-sidenav-show', '');
|
||||||
|
document.body.removeAttribute('data-sidenav-hidden');
|
||||||
} else {
|
} else {
|
||||||
|
document.body.removeAttribute('data-sidenav-pinned');
|
||||||
document.body.setAttribute('data-sidenav-hidden', '');
|
document.body.setAttribute('data-sidenav-hidden', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
}
|
||||||
|
window.addEventListener('resize', function(){ checkSideNav() });
|
||||||
|
checkSideNav();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{# Page layout #}
|
{# Page layout #}
|
||||||
|
Loading…
Reference in New Issue
Block a user