Adminlte customization of javascript not working


(Ja) #1

my sidebar:

(in frontend/views/layouts/content.php)


 <aside class="control-sidebar control-sidebar-light control-sidebar-open hidden-xs" style="position:fixed">


 </aside><div class="control-sidebar-bg  hidden-xs"></div>

Instructions on how to push content instead of slide over:


$("#my-toggle-button").controlSidebar(options);

(https://github.com/almasaeed2010/AdminLTE/issues/739)

My attempt to follow the instructions:

(in frontend/views/layouts/main.php)


   <script>

            // Enable or disable bootstrap tooltips globally, based on touch vs non-touch device

            if( "ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch )

            {

                // Touch-screen. Disable tooltips!

                var AdminLTEOptions = {

                    enableBSToppltip: false,

                    [b]controlSidebarOptions[/b]: {slide:false}                    

                };

            }

            else

            {

                // Non-touch-screen. Enable tooltips!

                var AdminLTEOptions = {

                    enableBSToppltip: true,

                    controlSidebarOptions: {slide:false}

                };

            }

        </script>

<?php

    dmstr\web\AdminLteAsset::register($this);

(essentially I modify AdminLTEOptions before I load the asset)

based on: https://adminlte.io/themes/AdminLTE/documentation/index.html#adminlte-options

Problem: It does not work, content is not pushed, but hidden behind the sidebar.

If I hardcode the class ‘control-sidebar-open’ into the body element the sidebar correcty pushes the content to the left, but as soon as you hide and show the sidebar the class does not magically add it self back to the body element and then the content is hidden parcially behind the right sidebar (control-sidebar)

I could ‘hack’ it by using javascript to add the class back to the body element each time you show the sidebar again, but I would rather use the actual plugins settings that do this automagically. :slight_smile:

Thank you for any help.

ps. Probably not necessary, but here is part of my button code that makes the sidebar show/hide:


id='collapsable-button' data-toggle="control-sidebar"