1.要用bootStrap这个框架就必须要重载它的class类,也就是说class要一样
代码如下:
有疑问的可以在下面留言,欢迎大家一起交流
1.1动态模态框
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <link href="https://www.jb51.net/bootstrap-3.3.7/css/bootstrap.css" > <script src="https://www.jb51.net/bootstrap-3.3.7/js/jquery.min.js"></script> <script src="https://www.jb51.net/bootstrap-3.3.7/js/bootstrap.min.js"></script> <script src="https://www.jb51.net/bootstrap-3.3.7/js/docs.min.js"></script> </head> <body> <div> <div> <div>bootstrap框架 <small>s</small> </div> </div> <!-- 动态框 --> <div> <!-- modal默认是隐藏的 --> <div> <div> <!-- 头部关闭按钮 --> <div> <button type="button" data-dismiss="modal"><span >×</span></button> <div>标题部分</div> <!-- 内容部分 --> <div> <P>这是内容部分</P> </div> <!-- 页脚 --> <div> <button type="button" data-dismiss="modal">Close</button> <button type="button">save</button> </div> </div> </div> </div> </div> <a href="#">显示对话框</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 content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <link href="https://www.jb51.net/bootstrap-3.3.7/css/bootstrap.css" > <script src="https://www.jb51.net/bootstrap-3.3.7/js/jquery.min.js"></script> <script src="https://www.jb51.net/bootstrap-3.3.7/js/bootstrap.min.js"></script> <script src="https://www.jb51.net/bootstrap-3.3.7/js/docs.min.js"></script> </head> <body> <div> <div> <div>bootstrap框架 <small>s</small> </div> <!-- 静态模态框 官方有一个bug就是在写静态框的时候在按钮上要绑定同一个class--> <div> <div> <div> <button type="button" data-dismiss="modal"> <span>×</span> </button> <h3>Model标题</h3> </div> <!-- body部分 --> <div> <p>这是身体部分</p> </div> <!-- footer部分 --> <div> <button data-dismiss="modal">close</button> <button>save</button> </div> </div> </div> </div> </div> </div> </div> </body> </html> <script> $(function(){ $('.myclose').click(function(){ $('.modal-dialog').css('display','none') }) }) </script>
总结
以上所述是小编给大家介绍的BootStrap的动态模态框及静态模态框,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
您可能感兴趣的文章: