2016-04-13 71 views
0

我的应用程序在我的本地机器上运行正常,但是,当我将它部署到heroku时,导航栏上的下拉菜单拒绝工作...这里是代码下拉bootstrap/javascript下拉菜单不能在heroku上工作

<li class="dropdown"> 
 
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Learning Wellness <span class="caret"></span> </a> 
 
     <ul class="dropdown-menu"> 
 
      <li><% yield (:exercise)%><%= link_to "Exercise", exercise_path%></li> 
 
      <li><% yield (:eating_healthy)%><%= link_to "Eating Healthy", eating_healthy_path%></li> 
 
      <li><% yield (:safety)%><%= link_to "Safety", safety_path%></li> 
 
      <li><% yield (:health_awareness)%><%= link_to "Health & Awareness", health_awareness_path%></li> 
 
     </ul> 
 
     </li> 
 

 
     <script type="text/javascript"> 
 
     $('.dropdown-toggle').dropdown() 
 
     </script>

我已经设置所有的资产进行预编译,我试图做手工。不知道为什么它不工作

编辑:

的application.js

//= require turbolinks 
 
//= require_tree . 
 
//= require jquery 
 
//= require jquery_ujs 
 
//= require bootstrap-sprockets 
 
//= require bootstrap 
 
//= require jquery.slick 
 
//= require initialize

回答

0

你的东东添加的document.ready功能:

$(document).ready(function() { 
    $('.dropdown-toggle').dropdown(); 
}); 

而不是

$('.dropdown-toggle').dropdown(); 

问候!

+0

添加了代码,推送到Heroku,仍然没有雪茄:/ – ncrouch25

+0

我想你已经包含了jquery和bootstrap js库。 –

+0

是的,我添加了一个图片到我原来的帖子 – ncrouch25