【问题标题】:Bootstrap Modal at Bottom Sheet底部工作表的 Bootstrap 模态
【发布时间】:2017-04-08 01:53:28
【问题描述】:

对于我的上一个项目,我现在将 Material Design 用于网站,我切换Bootstrap。现在,我正在寻找一种方法来在屏幕底部为用户创建引导模式显示操作。它们的作用仍然与常规模式相同。我正在寻找一种类似于materializecss 的Bottom Sheet Modal 的模态。 引导程序可以做到这一点吗?还是有现成的方法?

【问题讨论】:

    标签: javascript html css twitter-bootstrap materialize


    【解决方案1】:

    是的,但是你需要稍微改变一下modal css:

    注意:您需要做的唯一更改是为元素 class="modal-dialog" 添加样式

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>
    <body>
    
    <div class="container">
      <h2>Modal Example</h2>
      <!-- Trigger the modal with a button -->
      <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
    
      <!-- Modal -->
      <div class="modal fade" id="myModal" role="dialog" >
        <div class="modal-dialog" style="position:absolute;bottom:0;margin:0;width:100%;">
    
          <!-- Modal content-->
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title">Modal Header</h4>
            </div>
            <div class="modal-body">
              <p>Some text in the modal.</p>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
          </div>
    
        </div>
      </div>
    
    </div>
    
    </body>
    </html>
    

    示例来自:https://www.w3schools.com/bootstrap/bootstrap_modal.asp

    【讨论】:

    • 好的,谢谢。我现在只需要制作这个全宽。
    • 已经将我的代码编辑为全宽(:只需要添加宽度:100%;
    猜你喜欢
    • 2023-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-11
    • 2021-05-10
    • 1970-01-01
    相关资源
    最近更新 更多