2016-03-20 2 views
0

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

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

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

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

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

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

+0

У вас есть ответ, я получаю такой же вопрос ??? – Deep

+0

Не совсем, мне пришлось использовать что-то еще –

ответ

0

Поведение боковой панели не управляемый файлом 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(); 
      } 
     });}; 
Смежные вопросы