jQuery如何在单击另一个下拉按钮后重置以前打开的下拉列表

时间:2018-03-14 07:34:44

标签: jquery html

想在我的jquery上寻求帮助。我看到了关于我的下拉按钮的错误。当我打开一个下拉按钮时,它打开时带有一个负号,作为下拉菜单的标志,但当我点击另一个下拉按钮时,它也会打开相同的符号,但我之前没有重置为其正常形式与积极的象征。

这是我的意思截图。

enter image description here

在这里'我的代码:



$(document).ready(function() {
 $(".dropdown-toggle").click(function(e) {
        e.preventDefault();
        $('.dropdown-menu').not($(this).next('.dropdown-menu')).fadeOut()
        $(this).next('.dropdown-menu').fadeToggle().toggleClass('isOpen');


        if ($('.dropdown-menu').hasClass('isOpen')) {
            $(this).html("-"); 
            $(this).siblings('a').css("color", "#f37727");
            } else {
            $(this).html("+");
            $(this).siblings('a').css("color", "#000");
        }
    });
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="sdcollections-list">


      <li class="sdc-element">
        <a href="/collections/dogs">
          <div class="element-main">

            <div class="collection-area ">
              <div class="collection-name">
                Dogs 
              </div>
            </div>
          </div>
        </a>



          <ul>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-beds-and-bedding" style="color: rgb(243, 119, 39);">Dog Beds &amp; Bedding</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">-</button>
                                <ul class="dropdown-menu isOpen" style="display: none;">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/soft-dog-beds">Soft Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/mattress-dog-beds">Mattress Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/plastic-dog-beds-and-cushions">Plastic Dog Beds and Cushions</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/3-peaks">3 Peaks</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/luxury-dog-beds">Luxury Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-blankets">Dog Blankets</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/specific-dog-beds">Specific Dog Beds</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-coats-and-clothes" style="color: rgb(243, 119, 39);">Dog Coats &amp; Clothes</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">-</button>
                                <ul class="dropdown-menu isOpen" style="display: block;">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-heating-and-cooling-beds">Dog Heating and Cooling Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-cooling-and-calming">Dog Cooling and Calming</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-knitwear">Dog Knitwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-rainwear">Dog Rainwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-reflective-coats">Dog Reflective Coats</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-warmwear">Dog Warmwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/small-dog-coats">Small Dog Coats</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-collars">Dog Collars and Leads</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-collars">Dog Collars</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-leads">Dog Leads</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-extending-leads">Dog Extending Leads</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-tags-accessories">Dog Tags &amp; Accessories</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-flea-control-and-wormers">Dog Flea Control &amp; Wormers</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-flea-treatment">Dog Flea Treatment</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-wormers">Dog Wormers</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-grooming">Dog Grooming</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-clippers-and-scissors">Dog Clippers and Scissors</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-nail-clippers">Dog Nail Clippers</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-shampoo-conditioners">Dog Shampoo &amp; Conditioners</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-brushes-combs">Dog Brushes &amp; Combs</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-sprays-hygiene-products">Dog Sprays &amp; Hygiene Products</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-towels">Dog Towels</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-harness">Dog Harness</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-health-and-treatments">Dog Health &amp; Treatments</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-dental-care">Dog Dental Care</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-ear-care">Dog Ear Care</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-health-supplements">Dog Health Supplements</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-skin-and-creams">Dog Skin and Creams</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-kennels-and-flaps">Dog Kennels &amp; Flaps</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-kennels">Dog Kennels</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-pens">Dog Pens</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-flaps-and-gates">Dog Flaps and Gates</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-carriers">Dog Carriers</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-leads">Dog Leads</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-tags">Dog Tags</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-toys">Dog Toys</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/ball-and-outdoor">Ball and Outdoor</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/brain-games">Brain Games</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-chews">Dog Chews</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-novelty-toys">Dog Novelty Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-top-toys">Dog Top Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/toys-for-puppys">Toys For Puppys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-soft-toys">Dog Soft Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-tougher-toys">Dog Tougher Toys</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-training">Dog Training</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-anti-bark-accessories">Dog Anti-Bark Accessories</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-muzzles">Dog Muzzles</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-clicker-and-whistle-training">Dog Clicker And Whistle Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-chewing-solutions">Dog Chewing Solutions</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-toilet-training">Dog Toilet Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-agility-training">Dog Agility Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/other-training-solutions">Other Training Solutions</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-travel">Dog Travel</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/puppy-products">Puppy Products</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

          </ul>

      </li>
</ul>
&#13;
&#13;
&#13;

3 个答案:

答案 0 :(得分:1)

使逻辑变得简单。最初,您希望显示处于打开状态的某些菜单。因此,您必须保留特定列表项的isOpen类,并为按钮保留符号-,并应用a的颜色代码。通过CSS,尝试应用display属性,例如,如果列表项包含类isOpen,则将其设置为display:block其他display:none,如下所示。

 .dropdown-menu {
     display:none;
 }
 .dropdown-menu.isOpen {
     display:block;
 }

现在,如果单击某个按钮,则必须从其他列表项中删除isOpen类,并仅为当前列表项保留此类。此外,您必须为其他人创建按钮+,为当前创建-按钮。对于链接,您必须为当前链接应用不同的颜色,并为剩余链接保留默认颜色。这可以使用以下代码实现。

  $(".dropdown-toggle").click(function(e) {
    e.preventDefault();
    $('.dropdown-menu').not($(this).next('.dropdown-menu')).fadeOut();
    $('.dropdown-menu').removeClass('isOpen');
    $('.dropdown-menu').siblings('button').html("+");
    $('.dropdown-menu').siblings('a').css("color", "#000");
    $(this).next('.dropdown-menu').fadeToggle().addClass('isOpen');
    $(this).html("-");
    $(this).siblings('a').css("color", "#f37727");
  });

修改

以上情况会在一种情况下失败,例如,如果再次点击同一按钮,则显示错误的-按钮符号和a标记的错误颜色代码。为了修复我正在检查当前状态,然后更新当前元素的样式,如下所示。

$(document).ready(function() {
  $(".dropdown-toggle").click(function(e) {
    e.preventDefault();
    var close = $(this).html() == "-" ? false : true;
    $('.dropdown-menu').not($(this).next('.dropdown-menu')).fadeOut();
    $(this).next('.dropdown-menu').fadeToggle();
    $('.dropdown-menu').removeClass('isOpen');
    $('.dropdown-menu').siblings('button').html("+");
    $('.dropdown-menu').siblings('a').css("color", "#000");        
    if(close) {
      $(this).html("-");
      $(this).siblings('a').css("color", "#f37727");
    }        
  });
});
.dropdown-menu {
  display:none;
}
.dropdown-menu.isOpen {
  display:block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="sdcollections-list">


      <li class="sdc-element">
        <a href="/collections/dogs">
          <div class="element-main">

            <div class="collection-area ">
              <div class="collection-name">
                Dogs 
              </div>
            </div>
          </div>
        </a>



          <ul>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-beds-and-bedding" style="color: rgb(243, 119, 39);">Dog Beds &amp; Bedding</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">-</button>
                                <ul class="dropdown-menu isOpen">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/soft-dog-beds">Soft Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/mattress-dog-beds">Mattress Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/plastic-dog-beds-and-cushions">Plastic Dog Beds and Cushions</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/3-peaks">3 Peaks</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/luxury-dog-beds">Luxury Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-blankets">Dog Blankets</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/specific-dog-beds">Specific Dog Beds</a>
                                    </li>
                            
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-coats-and-clothes" style="color: rgb(243, 119, 39);">Dog Coats &amp; Clothes</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">-</button>
                                <ul class="dropdown-menu isOpen">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-heating-and-cooling-beds">Dog Heating and Cooling Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-cooling-and-calming">Dog Cooling and Calming</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-knitwear">Dog Knitwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-rainwear">Dog Rainwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-reflective-coats">Dog Reflective Coats</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-warmwear">Dog Warmwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/small-dog-coats">Small Dog Coats</a>
                                    </li>
                           
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-collars">Dog Collars and Leads</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-collars">Dog Collars</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-leads">Dog Leads</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-extending-leads">Dog Extending Leads</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-tags-accessories">Dog Tags &amp; Accessories</a>
                                    </li>

                           
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-flea-control-and-wormers">Dog Flea Control &amp; Wormers</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-flea-treatment">Dog Flea Treatment</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-wormers">Dog Wormers</a>
                                    </li>

                           
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-grooming">Dog Grooming</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-clippers-and-scissors">Dog Clippers and Scissors</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-nail-clippers">Dog Nail Clippers</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-shampoo-conditioners">Dog Shampoo &amp; Conditioners</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-brushes-combs">Dog Brushes &amp; Combs</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-sprays-hygiene-products">Dog Sprays &amp; Hygiene Products</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-towels">Dog Towels</a>
                                    </li>
                         
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-harness">Dog Harness</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">
                          
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-health-and-treatments" style="color: rgb(243, 119, 39);">Dog Health &amp; Treatments</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">-</button>
                                <ul class="dropdown-menu isOpen">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-dental-care">Dog Dental Care</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-ear-care">Dog Ear Care</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-health-supplements">Dog Health Supplements</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-skin-and-creams">Dog Skin and Creams</a>
                                    </li>
                           
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-kennels-and-flaps">Dog Kennels &amp; Flaps</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-kennels">Dog Kennels</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-pens">Dog Pens</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-flaps-and-gates">Dog Flaps and Gates</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-carriers">Dog Carriers</a>
                                    </li>
                             
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-leads">Dog Leads</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">
                            
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-tags">Dog Tags</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">
                             
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-toys">Dog Toys</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/ball-and-outdoor">Ball and Outdoor</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/brain-games">Brain Games</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-chews">Dog Chews</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-novelty-toys">Dog Novelty Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-top-toys">Dog Top Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/toys-for-puppys">Toys For Puppys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-soft-toys">Dog Soft Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-tougher-toys">Dog Tougher Toys</a>
                                    </li>

                          
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-training">Dog Training</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-anti-bark-accessories">Dog Anti-Bark Accessories</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-muzzles">Dog Muzzles</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-clicker-and-whistle-training">Dog Clicker And Whistle Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-chewing-solutions">Dog Chewing Solutions</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-toilet-training">Dog Toilet Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-agility-training">Dog Agility Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/other-training-solutions">Other Training Solutions</a>
                                    </li>
                             
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-travel">Dog Travel</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                              
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/puppy-products">Puppy Products</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                         
                                </ul>                                   
            </li>

          </ul>

      </li>
</ul>

如果您正在寻找小提琴版演示,那么Here you go.

答案 1 :(得分:0)

尝试在6.11.2上运行$ .each循环,而不仅仅是单.dropdown-menu项检查,请参阅下面的代码:

hasClass

以下是新增代码:

$(document).ready(function() {
 $(".dropdown-toggle").click(function(e) {
        e.preventDefault();
        $('.dropdown-menu').not($(this).next('.dropdown-menu')).fadeOut()
        $(this).next('.dropdown-menu').fadeToggle().toggleClass('isOpen');

        $('.dropdown-menu').each(function(){
            if($(this)..hasClass('isOpen')) {
                $(this).html("-").siblings('a').css("color", "#f37727");
            } else {
                $(this).html("+").siblings('a').css("color", "#000");        
            }
        });

    });
});

答案 2 :(得分:0)

你真的很接近它。但我想你只是忘记了这一行

if($(this).hasClass('isOpen'))

dropdown-menu永远不会有课程isOpen。下一个元素是拥有它的元素。所以正确的脚本是:

if($(this).next().hasClass('isOpen'))

修复后的小提琴

$(document).ready(function() {
 $(".dropdown-toggle").click(function(e) {
        e.preventDefault();
        $('.dropdown-menu').not($(this).next('.dropdown-menu')).fadeOut()
        $(this).next('.dropdown-menu').fadeToggle().toggleClass('isOpen');
var parentLi = $(this).closest('li');
if ($(this).next('.dropdown-menu').hasClass('isOpen')) {
            $(this).html("-"); 
            $(this).siblings('a').css("color", "#f37727");
            } else {
            $(this).html("+");
            $(this).siblings('a').css("color", "#000");
        }
        
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="sdcollections-list">


      <li class="sdc-element">
        <a href="/collections/dogs">
          <div class="element-main">

            <div class="collection-area ">
              <div class="collection-name">
                Dogs 
              </div>
            </div>
          </div>
        </a>



          <ul>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-beds-and-bedding" style="color: rgb(243, 119, 39);">Dog Beds &amp; Bedding</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu" style="display: none;">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/soft-dog-beds">Soft Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/mattress-dog-beds">Mattress Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/plastic-dog-beds-and-cushions">Plastic Dog Beds and Cushions</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/3-peaks">3 Peaks</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/luxury-dog-beds">Luxury Dog Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-blankets">Dog Blankets</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/specific-dog-beds">Specific Dog Beds</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-coats-and-clothes" style="color: rgb(243, 119, 39);">Dog Coats &amp; Clothes</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">-</button>
                                <ul class="dropdown-menu isOpen" style="display: block;">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-heating-and-cooling-beds">Dog Heating and Cooling Beds</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-cooling-and-calming">Dog Cooling and Calming</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-knitwear">Dog Knitwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-rainwear">Dog Rainwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-reflective-coats">Dog Reflective Coats</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-warmwear">Dog Warmwear</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/small-dog-coats">Small Dog Coats</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-collars">Dog Collars and Leads</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-collars">Dog Collars</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-leads">Dog Leads</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-extending-leads">Dog Extending Leads</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-tags-accessories">Dog Tags &amp; Accessories</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-flea-control-and-wormers">Dog Flea Control &amp; Wormers</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-flea-treatment">Dog Flea Treatment</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-wormers">Dog Wormers</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-grooming">Dog Grooming</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-clippers-and-scissors">Dog Clippers and Scissors</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-nail-clippers">Dog Nail Clippers</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-shampoo-conditioners">Dog Shampoo &amp; Conditioners</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-brushes-combs">Dog Brushes &amp; Combs</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-sprays-hygiene-products">Dog Sprays &amp; Hygiene Products</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-towels">Dog Towels</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-harness">Dog Harness</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-health-and-treatments">Dog Health &amp; Treatments</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-dental-care">Dog Dental Care</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-ear-care">Dog Ear Care</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-health-supplements">Dog Health Supplements</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-skin-and-creams">Dog Skin and Creams</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-kennels-and-flaps">Dog Kennels &amp; Flaps</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-kennels">Dog Kennels</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-pens">Dog Pens</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-flaps-and-gates">Dog Flaps and Gates</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-carriers">Dog Carriers</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-leads">Dog Leads</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-tags">Dog Tags</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-toys">Dog Toys</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/ball-and-outdoor">Ball and Outdoor</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/brain-games">Brain Games</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-chews">Dog Chews</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-novelty-toys">Dog Novelty Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-top-toys">Dog Top Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/toys-for-puppys">Toys For Puppys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-soft-toys">Dog Soft Toys</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-tougher-toys">Dog Tougher Toys</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-training">Dog Training</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-anti-bark-accessories">Dog Anti-Bark Accessories</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-muzzles">Dog Muzzles</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-clicker-and-whistle-training">Dog Clicker And Whistle Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-chewing-solutions">Dog Chewing Solutions</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-toilet-training">Dog Toilet Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/dog-agility-training">Dog Agility Training</a>
                                    </li>

                                    <li class="dropdown-menu-li">
                                        <a href="/collections/other-training-solutions">Other Training Solutions</a>
                                    </li>


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/dog-travel">Dog Travel</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

            <li class="list-unstyled nav-sub-mega">
              <a href="/collections/puppy-products">Puppy Products</a> 
                                <button class="dropdown-toggle" data-toggle="dropdown" href="#">+</button>
                                <ul class="dropdown-menu">


                                    <!--<li class="dropdown-menu-li"><a href="">Mattress Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Plastic Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">3 Peaks</a></li>    
                                    <li class="dropdown-menu-li"><a href="">Dog Blankets</a></li>
                                    <li class="dropdown-menu-li"><a href="">Heating Dog Beds</a></li>   
                                    <li class="dropdown-menu-li"><a href="">Specific Dog Beds</a></li>
                                    <li class="dropdown-menu-li"><a href="">Luxury Dog Bed</a></li>-->                                  
                                </ul>                                   
            </li>

          </ul>

      </li>
</ul>