How to fully parse Bootstrap pop-up window _ javascript tips-js tutorial

Source: Internet
Author: User
This article comprehensively analyzes the implementation method of Bootstrap pop-up window and analyzes its structure in detail. For more information, see I. Structure Analysis

The modal pop-up boxes in the Bootstrap framework use the "modal", "modal-dialog", and "modal-content" styles respectively, the real content of the pop-up window is placed in "modal-content", which mainly includes three parts:

☑The header of the pop-up box, usually indicated by "modal-header", mainly including the title and the close button

☑The body of the pop-up box, which is usually represented by "modal-body". The main content of the pop-up box

☑In the pop-up box, the foot is usually represented by "modal-footer". The operation button is mainly placed.

× CloseModal pop-up window title

Body content of the modal pop-up window

Close Save

Ii. data-toggle class trigger pop-up window (JS is not required)

1. Modal pop-up window DeclarationYou only need to customize two necessary attributes: data-toggle and data-target.

 Triggered by data-target
 

× CloseModal pop-up window title

Body content of the modal pop-up window

Close Save

2. data-parameter description

In addition to using data-toggle and data-target to control the modal pop-up window, the Bootstrap framework also provides other custom data-attributes for the modal pop-up box to control the modal pop-up window.

3. JS trigger pop-up window (JS to be written)

1. In addition to using custom properties to trigger the modal pop-up box, you can also use the JavaScript method to trigger the modal pop-up window. An event is triggered by an element. For example, you can give a button a click event and then trigger the modal pop-up window.

HTML:

Click me

× CloseModal pop-up window title

Body content of the modal pop-up window

Close Save

JS:

 $(function(){ $(".btn").click(function(){ $("#mymodal").modal("toggle"); }); });

2. When the JavaScript trigger mode pop-up window is used, the Bootstrap Framework provides some settings, including

Property settings:

$(function(){ $(".btn").click(function(){ $("#mymodal").modal({  keyboard:false }); });});

Parameter settings:

Event settings:

$ ('# Mymodal'). on ('den den. bs. modal', function (e) {// Process Code ...})

Iv. pop-up window size

The Bootstrap framework also provides different sizes for the modal pop-up window.

One is a large style"Modal-lg ".

  
  
    ... 
   

The other is small size style"Modal-sm ".

  
  
    ... 
   

The above is a full introduction to the implementation method of Bootstrap pop-up window. I hope it will be helpful for your learning.

Related Article

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.