Sidebar-collapse and Pace

Hi,

Ver: 2025.3

I am trying to default the sidebar nav menu to closed in the Login screen.

I have added the following in Page_Render (LOGIN)


        //  Set default for AdminLTE
        Global $BODY_CLASS;
        $BODY_CLASS .= " sidebar-collapse ";
        LOG("**** Collapse sidebar");

and also tried both of the following in “LoginPage Startup Script”


$( 'body' ).addClass( 'sidebar-collapse' );
$( '.pace-running' ).addClass( 'sidebar-collapse' );

Watching via Inspect in the browser the initial result as the page is loaded is

<body class="pace-running sidebar-collapse" style="cursor: default; height: auto;"

but then I watch the body tag get rewritten to


<body class="pace-running" style="cursor: default; height: auto;"

removing the additional classes I added. I haven’t added any code to do that. The final result is the menu is shown.

I have the AdminLTE Layout set to Layout-Fixed in the Advanced Options. Have tried sidebar-collapse as an option here as well just to see if I can get it working. No luck. Haven’t touched anything in the styling at all.

Any ideas would be much appreciated.

TIA
Steve.

You may refer to AdminLTE’s Push Menu Plugin options. You may want to enable enableRemember. Note the AdminLTE save the status by localStorage on clicking the push menu button, if you set it by CSS initially, the status is not saved. You may need to do something like (concept only, you need to modify code as needed yourself):

localStorage.setItem("remember.lte.pushmenu", "sidebar-collapse");
1 Like

Thanks. You put me onto the right track.

Did a bit more research after reading your post and looking at the code a bit closer. The code for the plugin was already in there and a jquery example I found had the plugin code and this jquery cmd

$('[data-widget="pushmenu"]').PushMenu('toggle');

which I simply dropped into LOGIN PAGE>Startup_Script.

Sorted. Many Thanks.