Подменю AdminLTE расширяется, а затем сворачивается

Я использую AdminLTE в проекте, который был запущен кем-то другим

Поведение, которое я вижу, когда добавляю подменю, заключается в том, что оно расширяется, а затем сразу же сворачивается.

Я пытался использовать полный <aside class="main-sidebar">...</aside> со страницы index.html, и все равно получаю то же поведение, что и здесь - https://gyazo.com/e88b049ccd7b2d06d65ccc7986166cdf

Если я открою index.html из шаблона локально, он отлично работает.

Я думаю, что в этом проекте может что-то отсутствовать, но я не могу понять, что... Пробовал загружать все js, и я не вижу ошибок в консоли.

Любая помощь будет оценена


person Safin Ahmed    schedule 20.03.2016    source источник
comment
У вас есть ответ, у меня такая же проблема???   -  person Deep Kakkar    schedule 03.02.2017
comment
не совсем, я должен был использовать что-то еще   -  person Safin Ahmed    schedule 04.02.2017


Ответы (1)


Поведение боковой панели контролируется не файлом index.html, а файлом app.js, расположенным в папке /dist/js adminlte. Вы должны иметь этот файл (среди прочих) в своем проекте.

Что я предлагаю, так это сначала посмотреть, не был ли ваш файл app.js изменен предыдущим парнем, который работал над проектом hte, или у вас могут быть в другом месте какие-то скрипты, которые перезаписывают поведение боковой панели по умолчанию.

Исходный код, управляющий левой боковой панелью, начинается со строки 380 файла app.js (adminlte v2.3.6) и выглядит следующим образом:

$.AdminLTE.tree = function(menu) {
  var _this = this;
  var animationSpeed = $.AdminLTE.options.animationSpeed;
  $(document).off('click', menu + ' li a')
      .on('click', menu + ' li a', function(e) {
          //Get the clicked link and the next element
          var $this = $(this);
          var checkElement = $this.next();

          //Check if the next element is a menu and is visible
          if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible')) && (!$('body').hasClass('sidebar-collapse'))) {
              //Close the menu
              checkElement.slideUp(animationSpeed, function() {
                  checkElement.removeClass('menu-open');
                  //Fix the layout in case the sidebar stretches over the height of the window
                  //_this.layout.fix();
              });
              checkElement.parent("li").removeClass("active");
          }
          //If the menu is not visible
          else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
              //Get the parent menu
              var parent = $this.parents('ul').first();
              //Close all open menus within the parent
              var ul = parent.find('ul:visible').slideUp(animationSpeed);
              //Remove the menu-open class from the parent
              ul.removeClass('menu-open');
              //Get the parent li
              var parent_li = $this.parent("li");

              //Open the target menu and add the menu-open class
              checkElement.slideDown(animationSpeed, function() {
                  //Add the class active to the parent li
                  checkElement.addClass('menu-open');
                  parent.find('li.active').removeClass('active');
                  parent_li.addClass('active');
                  //Fix the layout in case the sidebar stretches over the height of the window
                  _this.layout.fix();
              });
          }
          //if this isn't a link, prevent the page from being redirected
          if (checkElement.is('.treeview-menu')) {
              e.preventDefault();
          }
      });};
person Ouatataz    schedule 11.03.2017