zoukankan      html  css  js  c++  java
  • Bootstrap 模态框

    Bootstrap 模态框

    通过 data 属性:

      1、在控制器元素(比如按钮或者链接)上设置属性 data-toggle="modal"

      2、同时设置 data-target="#identifier" 或 href="#identifier" 来指定要切换的特定的模态框

    通过 JavaScript:

    • $('#identifier').modal(options)
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
        开始演示模态框
    </button>
    <!-- 模态框(Modal) -->
    <div class="modal fade" id="myModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel"  data-dismiss="modal">
                        模态框(Modal)标题
                    </h4>
                </div>
                <div class="modal-body">
                    在这里添加一些文本
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary">
                        提交更改
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

    2、使用keyboard

    <script>
    $(function() {
        $('#myModal').modal({
            keyboard: true
        })
    });
    </script>

    3、事件

    事件描述实例
    show.bs.modal 在调用 show 方法后触发。
    $('#identifier').on('show.bs.modal', function () {
      // 执行一些动作...
    })
    shown.bs.modal 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
    $('#identifier').on('shown.bs.modal', function () {
      // 执行一些动作...
    })
    hide.bs.modal 当调用 hide 实例方法时触发。
    $('#identifier').on('hide.bs.modal', function () {
      // 执行一些动作...
    })
    hidden.bs.modal 当模态框完全对用户隐藏时触发。
    $('#identifier').on('hidden.bs.modal', function () {
      // 执行一些动作...
    })

    参考:http://www.runoob.com/bootstrap/bootstrap-modal-plugin.html

  • 相关阅读:
    事务,视图,索引
    SQL 编辑
    相关子查询
    4
    3
    2
    1
    BaseEditor
    EDCheckPrefabRef
    UIUseImgWindow
  • 原文地址:https://www.cnblogs.com/tekkaman/p/6927251.html
Copyright © 2011-2022 走看看