模态对话框不适用于bootstrap 4

时间:2019-05-07 14:33:42

标签: javascript css ruby bootstrap-modal haml

我的代码不适用于引导程序4。单击按钮概述时,页面变暗,但未显示对话框。它与旧的引导程序一起工作。你能帮我吗?

        .form-group
          %label.control-label{ :for => "overview" }
            %a.btn.btn-info{ :href=> "#modaloverview", "data-toggle" => "modal"}
              INFO
          .modal.modal.hide.fade#modaloverview{ :tabindex => "-1", :role => "dialog", "aria-labelledby" => "modal-label", "aria-hidden" => "true"}
            .modal-header
              %button.close{ :type => "button", "data-dismiss" => "modal", "aria-hidden" => "true" }
                X
              %h3#modal-label
                titletextetxtetxtext
            .modal-body
              %p
                texttextetxtetxtettxtte
          .controls
            %textarea.form-control.input-xxlarge.allowMarkupShortcut#overview{ :rows => "10", :name => "overview" }
              - if @finding
                - if @finding.overview
                  #{meta_markup(@finding.overview)}

1 个答案:

答案 0 :(得分:0)

尝试这样更改代码:

您需要向按钮添加data-target属性,并将模型的ID赋值为

form-group %label.control-label{ :for => "overview" } 
%a.btn.btn-info{ :href=> "#modaloverview", "data-toggle" => "modal", "data-target" => "#myModal" } INFO 
#myModal.modal.modal.hide.fade#modaloverview{ :tabindex => "-1", :role => "dialog", "aria-labelledby" => "modal-label", "aria-hidden" => "true"} .modal-header %button.close{ :type => "button", "data-dismiss" => "modal", "aria-hidden" => "true" } X 
  %h3
    #modal-label titletextetxtetxtext 
 .modal-body
   %p texttextetxtetxtettxtte .controls                 
    %textarea.form-control.input-xxlarge.allowMarkupShortcut

  #overview{ :rows => "10", :name => "overview" } - if @finding - if @finding.overview #{meta_markup(@findin