Bootstrap模态框的简单示例

发布时间:2020-07-05 13:27:46 作者:oulafen
来源:网络 阅读:2371



前言


          使用之前要先引入bootstrap.css,bootstrap.js或bootstrap.min.js,两种js文件的区别是一个未压缩一个压缩,无需全部引入。

注意:所有插件都依赖jQuery(也就是说,jQuery必须在所有插件之前引入页面)


bootstrap引入方法:


将文件bootstrap.js或bootstrap.min.js放到所在项目的www/lib/js下

并在index.html中添加

<html ng-app='myApp'>
  <head>
<!--
-
- -->
    <link href='css/bootstrap.css' rel='stylesheet' type='text/css' />
  <body ng-controller='MainCtrl'>
<!--
-
- -->
    <script lang='javascript' src='lib/js/jquery/jquery-1.8.2.min.js'></script>
    <script lang='javascript' src='lib/js/bootstrap/bootstrap.min.js'></script>
<!--注意以上两者的顺序 -->

modal示例:


<body>
    <button ng-tap="test()" class="btn btn-primary">
        Click to show the modal
    </button>
    <div class="modal fade" id="myModal"   >
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"  >&times;</button>
                    <h5 class="modal-title" id="myModalLabel">Modal title</h5>
                </div>
                <div class="modal-body">
                    One fine body&hellip;
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
</body>

在Controller里调用

function TestController($scope ){
    $scope.test=function()
    {
        $('#myModal').modal('show');
    }
}

框效果如图:


Bootstrap模态框的简单示例



更多详解及bootstrap的应用请参考http://v3.bootcss.com/javascript/#modal

本人仍在不断学习中,欢迎交流指正。。。


推荐阅读:
  1. bootstrap 模态框
  2. Bootstrap 模态框插件

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

示例 bootstrap安装 模态框

上一篇:Python的应用

下一篇:在IOS XR上配置BFD

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》