creativetimofficial / ct-material-dashboard-pro

Material Dashboard Pro - Premium Bootstrap 5 Admin
https://demos.creative-tim.com/material-dashboard-pro/pages/dashboards/analytics
116 stars 28 forks source link

Sibar Mini not working on Material Dashboard Pro v2.1.2 #274

Closed Neo149 closed 3 years ago

Neo149 commented 4 years ago

Capture

Neo149 commented 4 years ago

Sidebar Mini not working

groovemen commented 4 years ago

Hello @Neo149,

Thank you for using our products and for letting us know about this issue, we will solve it into the next update. Until then, we'll ask you to delete the old initialization for perfectScrollbar and the sidebar will work properly.

Screenshot 2020-04-06 at 11 47 21

Your if statement should look like in the example below, so please change in your project in examples/dashboard.html at line 1117:

 if (md.misc.sidebar_mini_active == true) {
  $('body').removeClass('sidebar-mini');
  md.misc.sidebar_mini_active = false;

  if ($(".sidebar").length != 0) {
    var ps = new PerfectScrollbar('.sidebar');
  }
  if ($(".sidebar-wrapper").length != 0) {
    var ps1 = new PerfectScrollbar('.sidebar-wrapper');
  }
  if ($(".main-panel").length != 0) {
    var ps2 = new PerfectScrollbar('.main-panel');
  }
  if ($(".main").length != 0) {
    var ps3 = new PerfectScrollbar('main');
  }
  $('html').addClass('perfect-scrollbar-on');
} else {
  $('html').addClass('perfect-scrollbar-off');

  ps = null;

  setTimeout(function() {
    $('body').addClass('sidebar-mini');

    md.misc.sidebar_mini_active = true;
  }, 300);
}

Hope that information helps you. Please let us know if we can help you with anything else.

All the best, Stefan

Neo149 commented 4 years ago

Thank you.