我想在我的 Rails 应用程序中有一个模式/弹出窗口。最后,即使使用幻灯片/旋转木马。我遵循了几个教程,但都不起作用。例如:CrashingChandelier。此外,堆栈溢出的许多问题也无济于事,因为它们中的大多数都处理 js 文件。
本课程说它可以在不使用 Javascript 文件的情况下使用 Bootstrap-modal。虽然应该很简单,但我无法修复它,我不知道如何调试它。所以请帮助我。
这是带有按钮和模态的index.html.erb。
<!-- BUTTON -->
<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>
<!--MODAL-->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="pull-left"><h4>Your picture gallery</h4></div>
<button type="button" class="close" data-dismiss="modal" title="Close">
<span class="glyphicon glyphicon-remove"></span>
</button>
</div>
<div class="modal-body">
<p>hello, world!</p>
</div><!--end modal-body-->
<div class="modal-footer">
<div class="pull-left">
</div>
<button class="btn-sm close" type="button" data-dismiss="modal">Close</button>
</div><!--end modal-footer-->
</div><!--end modal-content-->
</div><!--end modal-dialoge-->
</div><!--end myModal-->
Run Code Online (Sandbox Code Playgroud)
这是我的application.scss
/*
*
*/
@import "bootstrap-sprockets";
@import "bootstrap"; …
Run Code Online (Sandbox Code Playgroud)