码迷,mamicode.com
首页 > Web开发 > 详细

jQuery BlockUI Plugin Demo 5(Simple Modal Dialog Example)

时间:2015-02-02 15:24:52      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

Simple Modal Dialog Example

This page demonstrates how to display a simple modal dialog. The button below will invoke blockUI with a custom message. Depending upon the user response (yes or no) an ajax call will be made while keeping the UI blocked.

The following code is used on this page:

<script type="text/javascript"> 
    $(document).ready(function() { 
 
        $(#test).click(function() { 
            $.blockUI({ message: $(#question), css: { width: 275px } }); 
        }); 
 
        $(#yes).click(function() { 
            // update the block message 
            $.blockUI({ message: "<h1>Remote call in progress...</h1>" }); 
 
            $.ajax({ 
                url: wait.php, 
                cache: false, 
                complete: function() { 
                    // unblock when remote call returns 
                    $.unblockUI(); 
                } 
            }); 
        }); 
 
        $(#no).click(function() { 
            $.unblockUI(); 
            return false; 
        }); 
 
    }); 
</script> 
 
... 
 
<input id="test" type="submit" value="Show Dialog" /> 
 
... 
 
<div id="question" style="display:none; cursor: default"> 
        <h1>Would you like to contine?.</h1> 
        <input type="button" id="yes" value="Yes" /> 
        <input type="button" id="no" value="No" /> 
</div>

For full-featured modal dialog support, check out Simple Modal by Eric Martin or jqModal by Brice Burgess.

参考:http://malsup.com/jquery/block/#overview

jQuery BlockUI Plugin Demo 5(Simple Modal Dialog Example)

标签:

原文地址:http://www.cnblogs.com/wolfocme110/p/4267739.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!