简体   繁体   English

bootstrap4 alpha3 js汉堡包菜单或模式在Rails 4中不起作用

[英]bootstrap4 alpha3 js hamburger menu or modal not working in rails 4

I am trying to get the hamburger menu working in rails 4 with bootstrap 4. The menu shows however, the dropdown portion of it is not working.I check other post on this matter to no avail. 我试图使汉堡菜单在带有Bootstrap 4的导轨4中工作。菜单显示了,但是下拉菜单不起作用。我对此事没有其他评论。

navabarFile navabarFile

<%# navbar begins %>
<nav class="navbar navbar-light" role="navigation">
<button class="navbar-toggler hidden-sm-up" type="button" data- toggle="collapse" data-target="#collapsing-navbar">
&#9776;
</button>
<div class="collapse navbar-toggleable-xs" id="collapsing-navbar">
<a class="navbar-brand" href="http://example.herokuapp.com/">
    <%= image_tag("greylogo.png", width: '180', height: '35', alt:'Crededx', class: "logo") %> 
  </a>
  <ul class="nav navbar-nav">
  <li class="nav-item">
    <a href="/messages" class="nav-link">Messages</a>
  </li>
  <li class="nav-item">
    <a href="/logout" class="nav-link">Logout</a>
  </li>
  </ul>
 </div>
</nav>
<%# navbar ends %>   

application.js application.js

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

A Bootstrap 4 ruby gem for Ruby on Rails (Sprockets) and Compass is available at: https://github.com/twbs/bootstrap-rubygem 适用于Ruby on Rails(链轮)和Compass的Bootstrap 4红宝石宝石可在以下网址获得: https//github.com/twbs/bootstrap-rubygem

Add bootstrap and autoprefixer to your Gemfile, see also https://github.com/twbs/bootstrap-rubygem/issues/29 : 将bootstrap和autoprefixer添加到您的Gemfile中,另请参阅https://github.com/twbs/bootstrap-rubygem/issues/29

gem 'bootstrap', '~> 4.0.0.alpha3'
gem 'autoprefixer-rails'
source 'https://rails-assets.org' do
  gem 'rails-assets-tether', '>= 1.1.0'
end

Run bundle install . 运行bundle install

Import Bootstrap styles in app/assets/stylesheets/application.scss: 在app / assets / stylesheets / application.scss中导入Bootstrap样式:

// Custom bootstrap variables must be set or import before bootstrap itself.
@import "bootstrap";

Add the Bootstrap Javascript plugins, tether and jQuery to your app/assets/js/application.js file: 将Bootstrap Javascript插件,tether和jQuery添加到您的app / assets / js / application.js文件中:

//= require jquery
//= require tether
//= require bootstrap

autoprefixer 自动前缀

Create a app/assets/stylesheets/browserslist, which contains the following browsers: 创建一个应用程序/资产/样式表/浏览器列表,其中包含以下浏览器:

Chrome >= 35
Firefox >= 38
Edge >= 12
Explorer >= 9
iOS >= 8
Safari >= 8
Android 2.3
Android >= 4
Opera >= 12

See also: https://github.com/twbs/bootstrap-rubygem/pull/30 另请参阅: https : //github.com/twbs/bootstrap-rubygem/pull/30

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM