2016-10-08 4 views
0

xをクリックしても通知が消えない。Railsアプリケーションで `x`をクリックするとブートストラップアラートが消えない

必須のCSSクラスがないとは思わないので、なぜこれが動作しないのか分かりません。

xをクリックする前に:

enter image description here

xをクリックした後:

enter image description here

application.html.erb

<html> 
    <body> 
    ... 
    <% if flash[:notice] %> 
     <div class="alert alert-success alert-dismissible fade out in"> 
      <button type="button" class="close" data-dismiss="alert"> 
      <span>&times;</span> 
      </button> 
      <%= flash[:notice] %> 
     </div> 
    <% elsif flash[:error] %> 
     <div class="alert alert-danger alert-dismissible fade out in"> 
      <button class="close" data-dismiss="alert">&times;</button> 
      <% flash[:error].each do |msg| %> 
       <li> 
       <%= msg %> 
       </li> 
      <% end %> 
     </div> 
    <% elsif flash[:alert] %> 
     <div class="alert alert-warning alert-dismissible fade out in"> 
      <button type="button" class="close" data-dismiss="alert">&times;</button> 
      <%= flash[:alert] %> 
     </div> 
    <% end %> 
    </body> 
</html> 

Gemfile.rb

gem 'bootstrap-sass' 

application.scss

@import 'bootstrap-sprockets'; 
@import 'bootstrap'; 

あなたは私がしようとすることをお勧めすることができます何か他のものはありますか?

+1

@import 'bootstrap-sprockets';に加えて必要とされた気づいていませんでしたか? – Ren

答えて

0

解決策。

//= require bootstrap-sprocketsをapplication.jsに追加します。

私は、これはあなたが正しくブートストラップ用のJavaScriptをロードしなかったapplication.scss

関連する問題