简体   繁体   English

一段时间后的blockUI

[英]blockUI after a time

when I click on a button I use this 当我点击一个按钮时,我会使用它

   $(document).ready(function () {
        $('.find').click(function () {
            $.blockUI({
                message: '<table><tr><td><img src="images/please_wait.gif"/></td></tr></table>',
                css: {},
                overlayCSS: {
                    backgroundColor: '#FFFFFF',
                    opacity: 0.4,
                    border: '0px solid #000000'
                }
            });
        });
    });

that shows a waiting image message. 显示等待的图像消息。 Now I want to show another message after some time(for example after 30seconds). 现在,我想在一段时间后(例如30秒后)显示另一条消息。 I don't know if I have to use the setTimeOut expression or other? 我不知道我是否必须使用setTimeOut表达式或其他表达式? Any suggestion? 有什么建议吗?

Use setTimeout 使用setTimeout

$(document).ready(function () {
    $('.find').click(function () {
        $.blockUI({
            message: '<table><tr><td><img src="images/please_wait.gif"/></td></tr></table>',
            css: {},
            overlayCSS: {
                backgroundColor: '#FFFFFF',
                opacity: 0.4,
                border: '0px solid #000000'
            }
        });

        setTimeout(function(){
           $.unblockUI();
           alert("New Message after 30 seconds");
        }, 30000);
    });
});

After 30 seconds UI will unblock and a new alert message will display. 30秒后,UI将解锁,并显示新的警报消息。

Hope this will help you. 希望这会帮助你。

Try this code: After your first message popup is closed, it will wait for 30 seconds and then trigger another message popup. 尝试以下代码:关闭第一个消息弹出窗口后,它将等待30秒,然后触发另一个消息弹出窗口。

            $.blockUI({
                message: '<table><tr><td><img src="images/please_wait.gif"/></td></tr></table>',
                css: {},
                overlayCSS: {
                    backgroundColor: '#FFFFFF',
                    opacity: 0.4,
                    border: '0px solid #000000'
                },
                onUnblock : function(){
                    setTimeout(function(){
                        $.blockUI({
                            message: '<table><tr><td><img src="images/please_wait.gif"/></td></tr></table>',
                            css: {},
                            overlayCSS: {
                                backgroundColor: '#FFFFFF',
                                opacity: 0.4,
                                border: '0px solid #000000'
                            }
                        });
                    }, 30000);
                }
            });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM