Jquery-based blockui plug-in display pop-up layer

Source: Internet
Author: User

Blockui can display a mask layer when you send an ajax request to prohibit users from performing operations on the page and display prompt information. It can also be used to display a login window or images.
The blockui plug-in mainly uses the blockUI and unblockUI methods to control the display or hiding of the pop-up layer. You can specify some parameters in the blockUI method to control the content, size, and position of the display of the pop-up layer. Common Parameters of the blockUI method include message, css, overlayCSS, and showOverlay.
Message: it is mainly used to set the content to be displayed. It can be directly set to a text segment, html code, or jquery to get the hidden div on the page.
Css: it is mainly used to set the style of the pop-up layer, including the position, size, and border of the pop-up layer.
OverlayCSS: used to set the style of the mask layer, including the background color and transparency.
ShowOverlay: Used to set whether to display the mask layer. To hide the mask layer, you can set it to false.
The following example shows how to import the jquery. min. js and jquery. blockui. js files on the page. The specific implementation code is as follows: Copy codeThe Code is as follows: $ ("# btnSubmit"). click (function (){
$. BlockUI ({
Message: $ ("# loginForm "),
Css :{
Width: '300px ',
Height: '300px ',
Left: ($ (window). width ()-300)/2 + 'px ',
Top: ($ (window). height ()-300)/2 + 'px ',
Border: 'none'
}
});
});
$ ("# BtnLogin"). click (function (){
$. BlockUI ({
Message: "Css :{
Border: '1px solid black'
}
});
SetTimeout (function () {$. unblockUI ()}, 1000 );
});
$ ("# BtnCancel"). click (function (){
$. UnblockUI ();
});

The corresponding html code is:Copy codeThe Code is as follows: <div id = "loginForm" style = "display: none">
<Table>
<Tr>
<Td> User name: </td>
<Td> <input id = "txtUserName" type = "text"/> </td>
</Tr>
<Tr>
<Td> password: </td>
<Td> <input id = "txtPwd" type = "text"/> </td>
</Tr>
<Tr>
<Td> <input id = "btnLogin" type = "button" value = "Logon"/> </td>
<Td> <input id = "btnCancel" type = "button" value = "cancel"/> </td>
</Tr>
</Table>
</Div>

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.