Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Nav bars not remember #5329

Open
faca5 opened this issue Sep 11, 2023 · 7 comments
Open

[BUG] Nav bars not remember #5329

faca5 opened this issue Sep 11, 2023 · 7 comments
Labels

Comments

@faca5
Copy link

faca5 commented Sep 11, 2023

Hello.

When you click on bars (left top corner) to minimize menu. It doesn't save setting on next click or refresh page.

Try to use local storage (or session cookies) to remember if main menu is full open or just minimized.

HTML code:

<ul class="navbar-nav">
  <li class="nav-item">
    <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
  </li>
  <li class="nav-item d-none d-sm-inline-block">
    <a href="index3.html" class="nav-link">Home</a>
  </li>
  <li class="nav-item d-none d-sm-inline-block">
    <a href="#" class="nav-link">Contact</a>
  </li>
</ul>

Local storage:
https://www.w3schools.com/jsref/prop_win_localstorage.asp
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Cookie session:
https://www.w3schools.com/js/js_cookies.asp

@faca5 faca5 added the type:bug label Sep 11, 2023
@codespearhead
Copy link

@faca5 Are you willing to work on a pull request?

@faca5
Copy link
Author

faca5 commented Sep 28, 2023

Hello.

I don't know yet.

If i will work on a pull request then i expect at least changes will be approved.

@codespearhead
Copy link

The contribution section says they're highly welcome.

@faca5
Copy link
Author

faca5 commented Sep 28, 2023

Thank you.

@jananivarthini455
Copy link

@faca5 hiii sir can u tell me requirements clearly like in local storage some value is adding what i need to add in localstorage ?

@faca5
Copy link
Author

faca5 commented Dec 14, 2023

Hello.

Simple fix!

Filename: adminlte.js

  var NAME$5 = 'PushMenu';
  var DATA_KEY$5 = 'lte.pushmenu';
  var EVENT_KEY$2 = "." + DATA_KEY$5;
...
  var Default$5 = {
    autoCollapseSize: 992,
    enableRemember: true,
    noTransitionAfterReload: true,
    animationSpeed: 300
  };

change from
enableRemember: false,
to
enableRemember: true,

@faca5
Copy link
Author

faca5 commented Dec 14, 2023

You can use something like that on older version.

        if(localStorage.getItem("YOUR_VARIABLE") == 1) {
            $(".sidebar-mini").addClass("sidebar-collapse");
        }
        $(".sidebar-toggle").on("click", function() {
			if(localStorage.getItem("YOUR_VARIABLE") == 1) {
				localStorage.setItem("YOUR_VARIABLE", null);
			} else {
				localStorage.setItem("YOUR_VARIABLE", 1);
			}
        } );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants