Regarding the hidden problem of bootstrap model

藏色散人
Release: 2020-11-30 17:25:34
Original
2096 people have browsed it

How to hide the bootstrap model: first introduce the file environment of boostrap and Jquery; then add a large div; finally hide the modal box by setting the "aria-hidden" attribute.

Regarding the hidden problem of bootstrap model

The operating environment of this tutorial: Windows 7 system, bootstrap version 3. This method is suitable for all brands of computers.

Recommended: "bootstrap video tutorial"

About boostrap’s modal hidden problem (front-end framework)

Modal (modal box)

First, introduce the file environment of boostrap and 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>
Copy after login

Usually a button or link triggers the modal

<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">开始演示模态框</button><!-- 模态框(Modal) -->
Copy after login

First add a large div, fade: fade in and fade out effect aria- hidden is to hide the modal box

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true")
Copy after login

Then under modal-content, insert 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 -->
Copy after login

× which is the symbol of X, Click Close or x or click "Ese" to exit the modal box

If you want to click to submit changes and exit the modal box, you can add an onclick event and add $ in the script ("#myModal").modal("hide"); as follows

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

The above is the exit function problem. As for the pop-up modal box, you can write a series of form-groups in the modal-body. Input box group, for details, please go to boostrap's official website to view the input box group. The code effect is as follows:

The above is the detailed content of Regarding the hidden problem of bootstrap model. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!