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.
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");
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");
}
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