scripts.js 975 B

1234567891011121314151617181920212223242526
  1. /*!
  2. * Start Bootstrap - SB Admin v7.0.7 (https://startbootstrap.com/template/sb-admin)
  3. * Copyright 2013-2023 Start Bootstrap
  4. * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-sb-admin/blob/master/LICENSE)
  5. */
  6. //
  7. // Scripts
  8. //
  9. window.addEventListener('DOMContentLoaded', event => {
  10. // Toggle the side navigation
  11. const sidebarToggle = document.body.querySelector('#sidebarToggle');
  12. if (sidebarToggle) {
  13. // Uncomment Below to persist sidebar toggle between refreshes
  14. // if (localStorage.getItem('sb|sidebar-toggle') === 'true') {
  15. // document.body.classList.toggle('sb-sidenav-toggled');
  16. // }
  17. sidebarToggle.addEventListener('click', event => {
  18. event.preventDefault();
  19. document.body.classList.toggle('sb-sidenav-toggled');
  20. localStorage.setItem('sb|sidebar-toggle', document.body.classList.contains('sb-sidenav-toggled'));
  21. });
  22. }
  23. });