javascript - 为什么我的下拉菜单在我的本地服务器上有效,但在我推送到 heroku 时却无效?

标签 javascript css ruby-on-rails drop-down-menu twitter-bootstrap

当我在本地测试我的站点时,它工作正常,但是一旦我推送到 heroku,下拉菜单就不起作用了。

我的 application.js 文件包含这个:

    //= require bootstrap
    //= require jquery
    //= require jquery_ujs
    //= require_tree .

我的 application.html.erb 文件包含这个

<!DOCTYPE html>
<html>
<head>
    <title> <%= full_title(yield(:title)) %> </title>
    <%= stylesheet_link_tag    "application", :media => "all" %>
    <%= javascript_include_tag "application" %>
    <%= csrf_meta_tags %>
    <%= render 'layouts/shim' %>
</head>

<body>
    <%= render 'layouts/header' %>  
    <div class="container">
        <%= yield %>
    </div>
</body>
</html>

我的标题部分是下拉菜单所在的地方,包含这个

<header class="navbar navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">
      <ul class="nav pull-left">
        <li>
      <%= link_to image_tag("WML_header2.png", :alt => 'Wheres My Lan'), home_path%> 
        </li>
      </ul>
      <nav>
        <ul class="nav pull-right">
            </br>
            <li><%= link_to "Heat Map",  heatMap_path %></li>
            <% if signed_in? %>
            <li><%= link_to "New Update",  new_message_path %></li>


            <li id="fat-menu" class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                View <b class="caret"></b>
              </a>
          <ul class="dropdown-menu">
            <li><%= link_to "Users", users_path %></li>
            <li><%= link_to "Reports", reports_path %></li>
            <li><%= link_to "Statistics", stats_path %></li>
          </ul>
        </li>


        <li id="fat-menu" class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            Account <b class="caret"></b>
          </a>
              <ul class="dropdown-menu">
                <li><%= link_to "Profile", current_user %></li>
                <li><%= link_to "Settings", settings_path %></li>
                <li class="divider"></li>
                <li>
                  <%= link_to "Sign out", signout_path, method: "delete" %>
                </li>
              </ul>
            </li>
          <% else %>
            <li><%= link_to "Admin sign in", signin_path %></li>

          <% end %>
          <li><%= link_to "About",  about_path %></li>
          <li><%= link_to "Contact", contact_path %></li>
        </ul>
      </nav>
    </div>
  </div>
</header>

最佳答案

生成的 HTML 是什么? Chrome 的开发人员工具栏是否报告了任何错误?

我猜它期望在某个位置有一个 javascript 文件,但在那里没有看到它。

关于javascript - 为什么我的下拉菜单在我的本地服务器上有效,但在我推送到 heroku 时却无效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11692260/

相关文章:

javascript - 将对象从 cshtml View 传递到 JQuery

javascript - 在新窗口中打开 DIV 按钮

css - 更少的可重用嵌套类

ruby-on-rails - railsfields_for渲染具有多个局部变量的局部变量,产生 undefined variable

ruby-on-rails - rails + Stripe : where to store what type of subscription a user has?

css - 我只能在 Sass 中使用嵌套

javascript - 乘以下拉AngularJS

javascript - 一张幻灯片中的多个图像

javascript - 文本按字长对齐

css - 如何使用 Bootstrap 查找和更改 CSS 值