Doubt with js function

2

Good morning, Srs. First of all, sorry for my questioning, I'm not a web programmer and I need to do something where I'm a layperson.

I'm trying to give a "simple" maintenance on a dashboard here of the company where I work, in it we have a bar on the left side that you can see below:

Thisleftbarbydefaultisexpanded,butwhenclickedontheiconmarkedwithreditreducesbygettingasfollows:

Theproblem:Ineedtomakethesidemenubydefaultcomeinareducedway,andnotexpandedasitcurrentlycomes

Tobeabletoidentifythatwhatitcallsthe"function" (I do not know how to call it) that reduces the menu is

<div class="nav toggle">
         <a id="menu_toggle"><i class="fa fa-bars"></i></a>
</div>

So I went into a .js file in the project and found the following code:

$(function () {
$('#sidebar-menu li ul').slideUp();
$('#sidebar-menu li').removeClass('active');

$('#sidebar-menu li').click(function () {
    if ($(this).is('.active')) {
        $(this).removeClass('active');
        $('ul', this).slideUp();
        $(this).removeClass('nv');
        $(this).addClass('vn');
    } else {
        $('#sidebar-menu li ul').slideUp();
        $(this).removeClass('vn');
        $(this).addClass('nv');
        $('ul', this).slideDown();
        $('#sidebar-menu li').removeClass('active');
        $(this).addClass('active');
    }
});

$('#menu_toggle').click(function () {
    if ($('body').hasClass('nav-md')) {
        $('body').removeClass('nav-md');
        $('body').addClass('nav-sm');
        $('.left_col').removeClass('scroll-view');
        $('.left_col').removeAttr('style');
        $('.sidebar-footer').hide();

        if ($('#sidebar-menu li').hasClass('active')) {
            $('#sidebar-menu li.active').addClass('active-sm');
            $('#sidebar-menu li.active').removeClass('active');
        }
    } else {
        $('body').removeClass('nav-sm');
        $('body').addClass('nav-md');
        $('.sidebar-footer').show();

        if ($('#sidebar-menu li').hasClass('active-sm')) {
            $('#sidebar-menu li.active-sm').addClass('active');
            $('#sidebar-menu li.active-sm').removeClass('active-sm');
        }
    }
});
});
/* Sidebar Menu active class */
$(function () {
var url = window.location;
$('#sidebar-menu a[href="' + url + '"]').parent('li').addClass('current-page');
$('#sidebar-menu a').filter(function () {
    return this.href == url;
}).parent('li').addClass('current-page').parent('ul').slideDown().parent().addClass('active')
});

How can I always do by default when opening URL it opens minimized right and not expanded as it is currently working?

    
asked by anonymous 16.11.2015 / 13:36

2 answers

1

I've moved with some screens like that. And I can tell you that the magic to change what you need is in the classes:

nav-md and nav-sm

Initially look in your html for one of these classes, in your body tag primarily. you'll probably find nav-md, switch to nav-sm.

Then change your function js

$('#menu_toggle').click(function () {

the same classes.

And try again.

    
16.11.2015 / 13:46
1

Replaces:

$('#sidebar-menu li ul').slideUp();

By:

$('#sidebar-menu li ul').slideDown();
    
16.11.2015 / 13:47