JQuery Blockui Implementation Lock screen

Source: Internet
Author: User

When we call backstage through Ajax in front-end , because of the different amount of data, may cause long wait, but at this time the waiting user can still manipulate other elements on the interface, such as re-click a button , This situation is not allowed. Or sometimes you need to perform certain operations, the user Interface lock screen, after a period of time to re-restore, of course, would like to add a layer of div to cover the page, but the jquery Blockui has helped you do this work, We can use simple JS code to achieve a variety of effects. jQuery Blockui use: Blockui's official website can be accessed via the following address, with a large number of demos available for reference http://www.malsup.com/jquery/block/

          First of course, to introduce Blockui, the following demo uses 1.6

<script type= "Text/javascript" src= "jquery-1.6.1.min.js" ></ script>

<script type="Text/javascript" src="jquery-block-ui.js" ></script>

11111111111111111111111111111111111

    • $ (function () {
    • lock screen immediately after loading and display Hello World as lock screen information
    • //If you want to lock the screen but do not display any information, you can set to null
    • $.blockui ({
    • Message:"Hello World";
    • })
    • })
22222222222222222222222222222222222222222222222222
  • $ (function () {
  • //can add style to Blockui
  • $.blockui ({css: {
  • border: "None",
  • padding: "15px",
  • BackgroundColor: "#000",
  • " -webkit-border-radius": "10px",
  • " -moz-border-radius": "10px",
  • Opacity:. 5,
  • Color: "#fff"
  • }})
  • })
33333333333333333333333333333333333333333333333333333333
    • $ (function () { 
    •     /*  
    •      *   can get a form with ID loginform directly for pop-up,  
    •      *   Implement a Popup-like function  
    •      */  
    •     $.blockui ({ 
    •          message : $ ( "#loginForm")  
    •      })  
    •     //2 seconds after closing occlusion  
    •     settimeout ($.unblockui,2000);  
    • })
4444444444444444444444444444444444444444444444444444
  • $ (function () {
  • $.blockui ();
  • SetTimeout (function () {
  • $.unblockui ({
  • //Perform a callback function to unlock the screen
  • Onunblock: function () {
  • Alert ("Onunblockui");
  • }
  • })
  • },2000);
  • });
5555555555555555555555555555555555555555555555555555555
    • $ (function () {
    • $.blockui ({
    • //When the lock screen is clicked to trigger an event elsewhere, it is triggered to unlock the screen
    • Onoverlayclick: $.unblockui
    • });
    • });
66666666666666666666666666666666666666666666666666666666
  • $ (function () {
  • //Set global ajax start lock screen
  • $ (document). Ajaxstart (function () {
  • Blocks ();
  • });
  • //Set global Ajax end unlocked
  • $ (document). AjaxStop (function () {
  • $.unblockui ();
  • });
  • });

JQuery Blockui Implementation Lock screen

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.