第三级JQuery下拉列表未显示

时间:2017-01-17 13:55:30

标签: javascript jquery html css3 opencart

尝试获得3级下拉列表。在Opencart中,我一直在使用第三方repsonsive菜单,效果很好。在这里展示并提供http://cssmenumaker.com/menu/responsive-flat-menu

但是,Opencart不支持3级别类别,因此需要插件https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=19296

加载了第3级别类别,但没有显示。任何人都可以帮助获得thrid类别和两个系统合并并显示超过1000px甚至加载+符号?

以下是Plunkr https://plnkr.co/edit/hZG4pbVCXQupf2kgqoKF?p=preview

中的下拉菜单
<div id="cssmenu"><div id="menu-button">Menu</div>
    <ul>
        <li class="has-sub"><span class="submenu-button"></span><a href="extractor-fans">Extractor Fans</a>
            <ul style="">
                <li><a class="arrow" href="/bathroom-extractor-fans">Bathroom Shower</a>
                    <div class="has-sub"><span class="submenu-button"></span>
                        <ul>
                            <li><a href="bathroom-vids">Designer Videos</a></li>
                        </ul>
                    </div>
                </li>
                <li><a href="ceiling-bathroom"> Bathroom Cabinets</a></li>
            </ul>
        </li>
    </ul>
</div>

3rd Dropdown not Displaying, although loaded

4 个答案:

答案 0 :(得分:5)

这是我的版本,不会更改您的itemhtml。所有更改都严格在js之内。大多数补救措施都是为了摆脱以下问题:

css

toJSON method

答案 1 :(得分:4)

我无法正确理解你的问题但是根据我的理解,我使用jQuery创建了一个两级下拉列表。 'div'标签用于'li'标签内,因此HTML必须构建得更多。

   $(document).ready(function() {
     $("#first li").children('ul').hide();
     $("#first li").hover(
       function() {
         $(this).children('ul').hide();
         $(this).children('ul').slideDown('fast');
       },
       function() {
         $('ul', this).slideUp('slow');
       });
     $("#second li").hover(
       function() {
         $(this).children('ul').hide();
         $(this).children('ul').slideDown('fast');
       },
       function() {
         $('ul', this).slideUp('slow');
       });

   });
        #cssmenu,
        #cssmenu ul,
        #cssmenu ul li,
        #cssmenu ul li a,
        #cssmenu #menu-button {
          line-height: 1;
          position: relative;
          display: block;
          -webkit-box-sizing: border-box;
          -moz-box-sizing: border-box;
          box-sizing: border-box;
          margin: 0;
          padding: 0;
          list-style: none;
          border: 0;
        }
        
        #cssmenu:after,
        #cssmenu > ul:after {
          line-height: 0;
          display: block;
          clear: both;
          height: 0;
          content: '.';
        }
        
        #cssmenu #menu-button {
          display: none;
        }
        
        #cssmenu {
          font-family: Arial, Helvetica, sans-serif;
          margin-top: 10px;
          margin-bottom: 10px;
          border-radius: none;
          background: #515151;
        }
        
        #cssmenu > ul > li {
          float: left;
        }
        
        #cssmenu > ul > li > a {
          font-size: 12px;
          font-weight: bold;
          padding: 10px 6px;
          text-decoration: none;
          letter-spacing: 1px;
          text-transform: none;
          color: #fff;
        }
        
        #first ul li a {
          background-color: white;
          font-size: 12px;
          font-weight: bold;
          padding: 10px 6px;
          text-decoration: none;
          letter-spacing: 1px;
          text-transform: none;
          color: black;
          margin-left: 20px;
        }
        
        #first ul ul li a {
          position: relative;
          left: 40px;
        }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<div id="cssmenu">
  <div id="menu-button">Menu</div>
  <ul id="first">

    <li class="has-sub"><a href="#">Extractor Fans</a>

      <ul id="second">

        <li>
          <div>
            <a class="arrow has-2nd-sub" href="#">Bathroom Shower</a>
          </div>
          <ul id="third">

            <li class="has-3rd-sub">
              <div><a href="#">Designer Videos</a></div>
              <div class="has-sub"><span class="submenu-button"></span>
              </div>
            </li>
          </ul>

        </li>
        <li><a href="#"> Bathroom Cabinets</a>
        </li>
      </ul>
    </li>


  </ul>
</div>

答案 2 :(得分:0)

您不应在<li>元素中使用div。

所以它看起来像这样:

     

  

<div id="cssmenu">
  <div id="menu-button">Menu</div>
  <ul>
    <li class="has-sub"><span class="submenu-button"></span><a href="extractor-fans">Extractor Fans</a>
      <ul style="">
        <li><a class="arrow" href="/bathroom-extractor-fans">Bathroom Shower</a>
            <ul class="has-sub submenu-button">
              <li><a href="bathroom-vids">Designer Videos</a></li>
            </ul>
        </li>
        <li><a href="ceiling-bathroom"> Bathroom Cabinets</a>
        </li>
      </ul>
    </li>
  </ul>
</div>

请参阅https://plnkr.co/edit/Xc0jSmZd3Qa0koklgUBG?p=preview

答案 3 :(得分:0)

只需更改css即可获得结果:

/* Line no 575*/
#cssmenu > ul > li > ul > li > div {
   left: -100%;
   top: 0px;
}
/* Line no 171*/
#cssmenu ul ul ul {
    top: 0;
    left: 0;
}

检查链接:https://plnkr.co/edit/qqqYbmwftggcggzvgjAQ?p=preview