如何禁用多级引导下拉列表?

时间:2016-10-17 20:08:57

标签: html twitter-bootstrap

我希望用户能够选择形态转换(侵蚀,膨胀,开放,闭合)中的所有内容,但不能选择“形态转换”。本身。谢谢你的每一个答案!

enter image description here

HTML代码:

<div class="container">
<div class="row">
    <hr>
    <div class="dropdown">
        <a id="dLabel" role="button" data-toggle="dropdown" class="btn btn-primary" data-target="#" href="/page.html">
            Select Pre-Processing Method <span class="caret"></span>
        </a>
        <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
          <li><a href="#">Normalisation</a></li>
          <li><a href="#">Canny Edge Detection</a></li>
          <li><a href="#">Smoothing</a></li>
          <li><a href="#"></a></li>
          <li class="divider"></li>

 ... 
          <li class="dropdown-submenu">
            <a tabindex="-1" href="#">Morphological Transformation</a>
            <ul class="dropdown-menu">
              <li><a>Erosion</a></li>
              <li><a>Dilation</a></li>
              <li><a>Opening</a></li>
              <li><a>Closing</a></li>
            </ul>
          </li>

  ...


            </ul>
          </li> 
        </ul>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

您可以停用锚定事件,保持悬停效果:

.disabled-link:hover{
   background: red;
}

.disabled-link:active{
   pointer-events: none;
}
<a href="www.google.com" class="disabled-link">Test</a>

所有现代浏览器可用click!