Bootstrap modal box disable blank place click Close _javascript Tips

Source: Internet
Author: User
Tags button type

The Modal Box (Modal) is a subform that is overwritten on the parent form. Typically, the intent is to display content from a single source, and you can interact without leaving the parent form. subforms provide information, interactivity, and so on. Bootstrap modal box by default, the Modal box is closed by clicking on other blank areas (usually the mask layer), and the following methods are prohibited from clicking on other areas to close the modal box.

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

When backdrop:static, the blank space does not close.

The ESC keyboard does not close when Keyboard:false.

The above code is also used to open the modal box.

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 ' >x</span></button>
   
 

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

If you want to further study, you can click here to learn, and then attach 3 wonderful topics:

Bootstrap Learning Course

Bootstrap Practical Course

Bootstrap Plugin Usage Tutorial

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.