简体   繁体   中英

Click Dropdown Menu Mobile Not Working

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


<li class="dropdown">
   <a class=dropdown-toggle data-toggle=dropdown href="#">
      <i class=material-icons>Button</i>
   </a>    
   <ul class="dropdown-menu dropdown-messages">
      <li><a href="profile"><i class=ti-user></i>&nbsp; Profile</a></li>
      <li><a href="logoutGeneral"><i class=ti-layout-sidebar-left></i>&nbsp; Logout</a></li>
   </ul>
</li>

Everything works fine in the browser even when shrinking it. But when I try to click a submenu HREF doesn't work it just closes the drop-down menu it doesnt redirect...

This is the official and proper way to make a bootstrap 3.3.7 dropdown button

<div class="dropdown">
  <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
    Dropdown
    <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
    <li><a href="test.html">Action</a></li>
    <li><a href="another-test.html">Another Link</a></li>
  </ul>
</div>

Reference bootstrap 3 - drop-down button

And also load the js file before the closing body tag. Working demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM