Bootstrap下拉菜单无法在WordPress中运行

时间:2015-12-18 08:39:20

标签: php jquery css wordpress twitter-bootstrap

我的菜单是使用wp bootstrap navwalker构建的,除了下拉菜单无效外,一切正常。我已经检查了 functions.php 中的jquery和 bootstrap.css boostrap.js 顺序的加载,一切看起来都正确。我使用这个从头开始构建了几个主题,但我在这个网站上进行了操作,我无法让它工作...... 如果有人可以提供建议,网站就在这里 - http://rala.missionarydesign.net/

2 个答案:

答案 0 :(得分:0)

您在HTML中使用了错误的data-target值。更新到以下内容。

<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false" aria-controls="navbar">

答案 1 :(得分:0)

试试这个

 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script><nav class = "navbar navbar-default" role = "navigation">
   
   <div class = "navbar-header">
      <button type = "button" class = "navbar-toggle" 
         data-toggle = "collapse" data-target = "#example-navbar-collapse">
         <span class = "sr-only">Toggle navigation</span>
         <span class = "icon-bar"></span>
         <span class = "icon-bar"></span>
         <span class = "icon-bar"></span>
      </button>
		
      <a class = "navbar-brand" href = "#">Example</a>
   </div>
   
   <div class = "collapse navbar-collapse" id = "example-navbar-collapse">
	
      <ul class = "nav navbar-nav">
         <li class = "active"><a href = "#">Home</a></li>
         <li><a href = "#">About</a></li>
			
         <li>
            <a href = "#" >
               Contact
              
            </a>
            
            
            
         </li>
			
      </ul>
   </div>
   
</nav>