Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (8)


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



Is there a way to keep the state of the sidebar-secondary? I can make it work with the primary one but not with the secondary sad


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(