延迟后加载jquery模态对话框 [英] load jquery modal dialog after a delay

查看:91
本文介绍了延迟后加载jquery模态对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在页面加载后延迟几秒钟后加载jquery对话框.到目前为止,这是我的代码.

I would like to load jquery dialog after a delay of few seconds after page load. Here is my code so far.

<div id="dialog" title="My Dialog Title" style="display:none">
<p>This is My Dialog box Description/Content</p>   

    <script type="text/javascript">

    $(document).ready(function() {    
    setTimeout(function(){
      $(function () {
        $("#dialog").dialog({
            show: {
            effect: 'drop',
            direction : 'up',
            distance: 1000,
            duration: 2000,
            },
        });
      });
    }, 2000)
});


</script>

    <style>
.ui-dialog-titlebar {display:none;}
#other_content {width:200px; height:200px;background-color:grey;}
#dialog_content{display:none;}
</style>

现在的问题是,从顶部滑动的弹出动画对于Chrome来说很好,但是在firefox中,它不会出现在屏幕中央,对于IE来说根本没有弹出窗口.

The problem is now that the popup animation of sliding from top is good for Chrome but in firefox it does not come to the center of the screen and for IE there is no popup at all.

http://jsfiddle.net/fakhruddin/x39Rr/9/

请指导.

推荐答案

使用setTimeout()进行延迟.

$(document).ready(function() {    
    setTimeout(function(){

        $("#dialog").dialog({
            show: {
            effect: 'fade',
            duration: 800,
            },
        });

    }, 2000)
});

这篇关于延迟后加载jquery模态对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆