0

ダイアログがポップアップするまでにどのくらいの時間がかかるのでしょうか。たとえば、サイトにアクセスするときに、ポップアップが表示される30秒前に設定したいと思います。それは可能ですか?

<script type="text/javascript">
            $(function(){
                // Dialog           
                if ($.cookie('showDialog') == undefined || $.cookie('showDialog') == null || $.cookie('showDialog') != 'false') {
                $('#dialog').dialog({
                    autoOpen: true,
                    width: 700,
                    modal: true,
                    buttons:{ "No Thanks": function() { $(this).dialog("close"); $.cookie('showDialog', 'false');  } },

                });
                }
                // Dialog Link
                $('#dialog_link').click(function(){
                    $('#dialog').dialog('open');
                    return false;
                });

                //hover states on the static widgets
                $('#dialog_link, ul#icons li').hover(
                    function() { $(this).addClass('ui-state-hover'); }, 
                    function() { $(this).removeClass('ui-state-hover'); }
                );

            });
</script>
4

1 に答える 1

4

使用できますsetTimeout()

setTimeout(function() {
    $('#my-dialog').dialog('open');
},30000);

jsフィドル

于 2012-07-05T19:21:55.017 に答える