Disable blank spaces in the Bootstrap modal box and click Close. bootstrap Modal

Source: Internet
Author: User

Disable blank spaces in the Bootstrap modal box and click Close. bootstrap Modal

A Modal box is a child form that overwrites the parent form. Normally, the purpose is to display the content from a separate source. Some interactions can be made without leaving the parent form. Subforms provide information and interaction. By default, the modal box of bootstrap is closed when you click other blank areas (usually the mask layer). In this case, do not click other areas to close the modal box.

$ ('# Mymodal'). modal ({backdrop: 'static', keyboard: false });

Backdrop: static, the blank space is not closed.

When keyboard is set to false, the esc keyboard is not disabled.

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 custocustom-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"> × </span> </button> 

Data-backdrop = "static" specifies a static background. When you click the outside of the modal box, the modal box is not closed. Data-keyboard is used to close the modal box when the escape key is pressed. If it is set to false, the key is invalid.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.