BootStrap Modal box disable blank place click Close

Source: Internet
Author: User

A modal box (Modal) is a subform that is overridden on a parent form. Typically, the goal is to display content from a single source, and you can have some interaction without leaving the parent form. Subforms can provide information, interactivity, and so on. Bootstrap modal box by default, click on a different blank area (usually the mask layer), the modal box will be closed, the following method is to prevent clicking on other areas to close the modal box.

$ (' #myModal '). Modal ({backdrop: ' static ', keyboard: false});

Backdrop:static, the blank space is not closed.

The ESC keyboard does not close when Keyboard:false.

The above code is also used to open modal boxes.

You can also use the following methods:

<div class= "modal" id= "Mymodal" tabindex= "-1" role= "dialog" aria-labelledby= "Mymodallabel" aria-hidden= "true" data-backdrop= "Static" data-keyboard= "false" >
<div class= "Modal-dialog custom-dialog succ-dialog" >
<div class= "Modal-content" >
<div class= "Modal-header" >
<button type= "button" class= "Close" data-dismiss= "modal" aria-label= "close" ><span aria-hidden= "true" > &times;</span></button>
</div>
<div class= "Modal-body" >
<div><p><span> bid success! </span></p></div>
</div>
</div>
</div>
</div>

The data-backdrop= "Static" here specifies a static background that does not close the modal box when the user clicks outside the modal box. Data-keyboard is when the escape key is pressed to close the modal box and set to False when the key is not valid.

BootStrap Modal box disable blank place click Close

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.