2016-04-13 68 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