有些时候无法点击注册下拉菜单

时间:2016-12-07 07:22:17

标签: javascript html css twitter-bootstrap

_header.html.erb

        <li><a data-toggle="modal" data-target="#myModal" id="modal-open">LOG IN</a></li>
        <li class="dropdown">
          <a href='#' class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
            SIGN UP<b class="caret"></b>
          </a>
          <ul class="dropdown-menu">
            <li><%= link_to "<i class='fa fa-user-plus'></i> Join an existing organization".html_safe, new_user_registration_path %></li>
            <li><%= link_to "Nonprofit Organization Sign Up",  signup_path %></li>
            <li><%= link_to "Donor Organization Sign Up" , signup_path(donor: :t) %></li>
          </ul>
        </li>

  

出于某种原因,如果我使用注册下拉菜单有时会转到不同的注册页面,我将无法再单击注册下拉列表。它只是停止可点击。我无法让我的下拉列表工作。我可以让导航栏完美显示,但是当我点击“Dropdown”(其中任何一个)时,它不会显示下拉菜单。当我看到使用inspect时,它设置了aria-expanded =“false”

application.html.erb

<!DOCTYPE html>
<html>
<head>
  <meta name="developers" content="Email grant@meansdatabase.com for an API key or a job offer.">
  <title><%= full_title(yield(:title)) %></title>
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
  <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBtBviyUbOQ2CeVxhO_eBNKQipiPwDPAs8&callback"
  type="text/javascript"></script>

  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks' => true %>
  <%= javascript_include_tag "https://www.google.com/jsapi", "chartkick" %>
  <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.1.0/intro.min.js", "data-turbolinks-track" => true %>

  <%= csrf_meta_tags %>
  <%= render 'layouts/icons' %>
  <%= render 'layouts/shim' %>
  <%= render 'layouts/google_SEO' %>
  <%= render 'layouts/facebook_tags' %>
  <%= render 'layouts/stripe_includes' %>

  <%= display_meta_tags :site => 'MEANS Database' %>
  <% if content_for?(:head) %>
    <%= yield(:head) %>
  <% end %>
</head>
<body class='<%= controller.controller_name %>'>

<!-- Modal -->
            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
              <div class="modal-dialog" role="document">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Quick Login</h4>
                  </div>
                  <div class="modal-body">

                    <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>

                      <%= f.label :email %>
                      <%= f.email_field :email, autofocus: true, class: 'form-control', id:'modal-email' %>

                      <%= f.label :password %>
                      <%= f.password_field :password, autocomplete: "off", class: 'form-control' %>

                      <% if devise_mapping.rememberable? -%>
                        <div class="field">
                          <%= f.check_box :remember_me %>
                          <%= f.label :remember_me %>
                        </div>
                      <% end -%>

                      <%= f.submit "Log in", class: "btn btn-primary" %>
                      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                      <% end %>
                    Having trouble logging in? Go to the full <%= link_to "LOG IN", new_user_session_path %> page for more options.
                  </div>
                  <div class="modal-footer">
                  </div>
                </div>
              </div>
            </div>
<%= render 'layouts/messages' %>
<%= render 'layouts/header' %>
<div class="container-fluid">
  <%= yield %>
  <%= render 'layouts/developer' if (Rails.env.development? || (current_user && current_user.developer == true)) %>
</div>

<%= render 'layouts/footer' %>

</body>

</html>

 <a href='#' class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">

enter image description here

这些是我在控制台上遇到的错误。

enter image description here

1 个答案:

答案 0 :(得分:0)

您的问题可能是由于Turbolinks造成的。您可以在Bootstrap 3 dropdown doesn't work with Rails 4 & Turbolinks

找到答案