bootstrap 模态框用法


当前第2页 返回上一页

1、按顺序引入以下三个文件(推荐:《bootstrap教程》)

1

2

3

<link rel="stylesheet" href="../css/bootstrap.min.css">

<script sype="text/JavaScript" src="./jquery.min.js"></script>

<script sype="text/JavaScript" src="../js/bootstrap.min.js"></script>

2、在页面中copy下面的代码

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">开始演示模态框</button>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

    <div class="modal-dialog">

        <div class="modal-content">

            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>

                <h4 class="modal-title text-center" id="myModalLabel">标题是什么</h4>

            </div>

            <div class="modal-body">

                写你HTML文本

            </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>

简单吧,模态框就是需要一个触发,在触发模态框的html元素加入以下属性data-toggle="modal" data-target="#myModal"

观察以下就会发现 这个data-target="#myModal"中的myModal就是模态框所在div的id <div class="modal fade" id="myModal".............>

以上就是bootstrap 模态框用法的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

bootstrap的优缺点有哪些

bootstrap是js类库么

bootstrap 怎么添加关闭按钮

bootstrap作用是什么

bootstrap里面有什么东西

bootstrap基本结构有哪些

bootstrap如何让div居右

bootstrap用什么开发工具

为什么要使用bootstrap

bootstrap特点是什么意思

更多相关阅读请进入《bootstrap》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...