关于bootstrap model隐藏问题

藏色散人
发布: 2020-11-30 17:25:34
原创
2095 人浏览过

bootstrap model隐藏的方法:首先外引boostrap和Jquery的文件环境;然后添加一个大的div;最后通过设置“aria-hidden”属性隐藏模态框即可。

关于bootstrap model隐藏问题

本教程操作环境:windows7系统、bootstrap3版,该方法适用于所有品牌电脑。

推荐:《bootstrap视频教程

关于boostrap的modal隐藏问题(前端框架)

Modal(模态框)

首先,外引boostrap和Jquery的文件环境:

    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
登录后复制

一般是按钮或者链接触发modal

<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">开始演示模态框</button><!-- 模态框(Modal) -->
登录后复制

首先添加一个大的div,   fade:淡入淡出的效果  aria-hidden是为了隐藏模态框

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true")
登录后复制

然后在modal-content下,插入modal-header,modal-body,modal-footer

<div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">模态框(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 -->
登录后复制

×就是X的符号,点击关闭或者x或者点“Ese”都可以退出模态框

如果,你想点击提交更改也可以退出模态框,你可以添加一个onclick事件,在script里添加$("#myModal").modal("hide");如下

<button type="button" class="btn btn-primary" onclick="user_del()" id="user-change">提交更改</button>
登录后复制
 function user_del(){
    $("#user").modal(&#39;hide&#39;);
}
登录后复制

以上就是退出功能问题,至于弹出的模态框,可以在modal-body里写入一系列的form-group,输入框组,详情进入boostrap的官网查看输入框组的学习即可,代码效果如下:

 

以上是关于bootstrap model隐藏问题的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!