Bootstrap implementing a pop-up window

Source: Internet
Author: User

Bootstrap uses Modal-dialog to implement the Bullets dialog box.

A dialog box contains 3 parts:

dialog box Head Modal-header

dialog box Content Body modal-body

Modal-footer at bottom of dialog box

The following HTML can be placed anywhere in the <body> tag, I am accustomed to follow the <body> tag.

HTML code snippet:

<div class= "Modal Fade" id= "Loginmodalid" tabindex= "-1" role= "dialog" aria-hidden= "true" ><div class= " Modal-dialog "><div class=" modal-content "><div class=" Modal-header "><button type=" button "class=" Close "data-dismiss=" modal "aria-hidden=" true ">x</button>

The default div is the hidden aria-hidden= "true"

Display effect:

Adds a button that triggers a popup dialog.

<button type= "button" class= "btn btn-blue nav-external animated hiding" id= "Loginbntid" hidden= "true" > click Login ... </button>

Add the JS code , and when the button Loginbtnid is pressed, the dialog box ($ (' #loginModalId ') is displayed. Modal (' show '); ).

$ (document). Ready (function () {document.getElementById ("Loginbntid"). onclick = function () {$ (' #loginModalId '). Modal (' Show ');} document.getElementById ("Loginmodalyesid"). onclick = function () {$ (' #loginModalId '). Modal (' hide '); alert ("Login function not implemented! ");}});

adds a Click event to the Login button on the dialog box, and hides the dialog box after the event occurs ( $ (' #loginModalId '). Modal (' hide '); ) and trigger the login action ("Login function not implemented!") ")

Reference:

Http://www.runoob.com/bootstrap/bootstrap-modal-plugin.html?from=androidqq

Bootstrap implementing a pop-up window

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.