Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Can't get the sidemenu toggle icon to switch


On the demo page, the icon to minimize/bring back the sidemenu changes when you toogle, but when I downloaded the ASP.net demo, it doesn't seem to work as expected and can't figure out how to fix.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (7)


Any news?



Hi,

I want to apologize for the late reply.

To fix this issue you should add the js/layout/sidebar.js to DefaultDarkSidebar.cshtml and DefaultLightSidebar.cshtml.


KTTheme.AddJavascriptFile("js/layout/sidebar.js");


Regards,
Lauris Stepanovs,
Keenthemes Support Team



That didn't do any difference.
But was able to fix by changing this line:
KTTheme.AddHtmlAttribute("sidebar", "data-kt-toggle-state", "active");
to this:
KTTheme.AddHtmlAttribute("sidebar-toggle", "data-kt-toggle-state", "active");


inside the DefaultLightSidebar.cshtml

So it seems everything is okay now. You can close this!



Hi,

The function handleToggle in js/layout/sidebar.js should handle the animation, please make sure this function gets triggered on page load.

Glad to hear you managed to find an alternative solution, please let us know if you need any further help on this topic or with anything else.

Regards,
Lauris Stepanovs,
Keenthemes Support Team



Indeed the handleToggle function is in the js/layout/sidebar.js and it does handle the animation.
But that's already bundled up in js/scripts/bundle.js so adding it again is not solving it.

The solution I found and sent earlier wasn't complete though.
The final code that got it working is this:


KTTheme.AddHtmlAttribute("sidebar-toggle", "data-kt-toggle-state", "active");
if (Context.Request.Cookies["sidebar_minimize_state"] != null && String.Equals(Convert.ToString((Context.Request.Cookies["sidebar_minimize_state"])), "on"))
{
KTTheme.AddHtmlAttribute("body", "data-kt-app-sidebar-minimize", "on");
KTTheme.AddHtmlClass("sidebar-toggle", "active");
}
else
{
KTTheme.AddHtmlAttribute("body", "data-kt-app-sidebar-minimize", "off");
}


I think that fixes it for good!
Thanks,
Cris



Metronic 8.2.7 for Asp.Net.
I don't get any errors neither when building the solution, nor when I click the toggle itself.
The toggle works as intended, it just doesn't rotate the icon.



Hi,

Thank you for reaching out to us.

Could you please specify which Metronic version you are using?

Do you get any errors when toggle the sidebar?

Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(