您现在的位置是:群英 > 开发技术 > web开发
Bootstrap动态模态框怎么用,要注意什么
Admin发表于 2022-08-15 17:33:50518 次浏览
这篇文章分享给大家的内容是关于Bootstrap动态模态框怎么用,要注意什么,本文介绍得很详细,内容很有参考价值,希望可以帮到有需要的小伙伴,接下来就让小编带领大家一起了解看看吧。


1.要用bootStrap这个框架就必须要重载它的class类,也就是说class要一样

代码如下:

有疑问的可以在下面留言,欢迎大家一起交流

1.1动态模态框

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.css" rel="external nofollow" rel="external nofollow" >
  <script src="bootstrap-3.3.7/js/jquery.min.js"></script>
  <script src="bootstrap-3.3.7/js/bootstrap.min.js"></script>
  <script src="bootstrap-3.3.7/js/docs.min.js"></script>

</head>
<body>
    <div class="container">
        <div class="page-header">
          <div class="h2">bootstrap框架 <small>s</small>
          </div>
        </div>
  <!-- 动态框 -->
<div class="modal">
  <!-- modal默认是隐藏的 -->
  <div class="modal-dialog">         
    <div class="modal-content">
     <!-- 头部关闭按钮 -->
      <div class="modal-header">       
        <button type="button" class="close myclose" data-dismiss="modal"><span >×</span></button>
        <div class="h3 modal-title">标题部分</div>
        <!-- 内容部分 -->
        <div class="modal-body">
          <P>这是内容部分</P>
        </div>
        <!-- 页脚 -->
        <div class="modal-footer">
          <button type="button" class="btn btn-primary myclose" data-dismiss="modal">Close</button>
          <button type="button" class="btn btn-warning myclose">save</button>
        </div>
      </div>
    </div>
  </div>
  
</div>
  <a href="#" rel="external nofollow" class="btn btn-success" id="show">显示对话框</a>
    </div>
</body>
</html>
<script>
  $(function(){
    $('#show').click(function(){
      $('.modal').modal('show')
    })
  })
</script>

1.2静态模态框

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.css" rel="external nofollow" rel="external nofollow" >
  <script src="bootstrap-3.3.7/js/jquery.min.js"></script>
  <script src="bootstrap-3.3.7/js/bootstrap.min.js"></script>
  <script src="bootstrap-3.3.7/js/docs.min.js"></script>
</head>
<body>
  <div class="container">
    <div class="page-header">
      <div class="h2">bootstrap框架 <small>s</small>
      </div>
      
     <!-- 静态模态框 官方有一个bug就是在写静态框的时候在按钮上要绑定同一个class-->
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close myclose" data-dismiss="modal">
                <span>×</span>
              </button>
              <h3>Model标题</h3>              
           </div>
           <!-- body部分 -->
           <div class="modal-body">
             <p>这是身体部分</p>
           </div>
           <!-- footer部分 -->
           <div class="modal-footer">
             <button class="btn btn-info myclose" data-dismiss="modal">close</button>
             <button class="btn btn-primary myclose">save</button>
           </div>
          </div>
        </div>
      </div>
 </div> 
   </div>
  </div>
</body>
</html>
<script>
  $(function(){
    $('.myclose').click(function(){
      $('.modal-dialog').css('display','none')
    })
  })
</script>

总结


通过以上内容的阐述,相信大家对“Bootstrap动态模态框怎么用,要注意什么”已经有了进一步的了解,更多相关的问题,欢迎关注群英网络或到群英官网咨询客服。

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

相关信息推荐
2022-06-22 17:46:53 
摘要:本篇文章带大家了解一下angular中的HttpClientModule模块,介绍一下请求方法、请求参数、响应内容、拦截器、Angular Proxy等相关知识,希望对大家有所帮助!
2022-09-16 17:55:40 
摘要:组件是vue的特性,它是Vue最强大的功能之一。在Vue中,组件可以扩展HTML元素,封装可重用的代码;在较高层面上,组件是自定义元素,Vue的编译器为它添加特殊功能;在有些情况下,组件也可以是原生HTML元素的形式,以is特性扩展。
2021-12-08 19:18:10 
摘要:篇文章主要介绍PHP的isset和empty函数的使用区别的内容,对大家理解isset()和empty()的不同有一定参考价值,感兴趣的朋友可以了解一下,希望大家阅读完这篇文章能有所收获,接下来小编带着大家一起了解看看。
云活动
推荐内容
热门关键词
热门信息
群英网络助力开启安全的云计算之旅
立即注册,领取新人大礼包
  • 联系我们
  • 24小时售后:4006784567
  • 24小时TEL :0668-2555666
  • 售前咨询TEL:400-678-4567

  • 官方微信

    官方微信
Copyright  ©  QY  Network  Company  Ltd. All  Rights  Reserved. 2003-2019  群英网络  版权所有   茂名市群英网络有限公司
增值电信经营许可证 : B1.B2-20140078   粤ICP备09006778号
免费拨打  400-678-4567
免费拨打  400-678-4567 免费拨打 400-678-4567 或 0668-2555555
微信公众号
返回顶部
返回顶部 返回顶部