最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Popup Dialog Hide after 10sec - Stack Overflow

programmeradmin1浏览0评论

I am working on some website , i have used jQuery UI , for pop-up dialog .

I want to close that after 10sec, I have used fadOut 10000 ms but its slowly fades.

Here is the link

View the source code and please help me in this.

I am working on some website , i have used jQuery UI , for pop-up dialog .

I want to close that after 10sec, I have used fadOut 10000 ms but its slowly fades.

Here is the link

View the source code and please help me in this.

Share Improve this question edited Sep 3, 2009 at 10:56 Steve Harrison 126k17 gold badges89 silver badges73 bronze badges asked Sep 3, 2009 at 10:54 Wasim ShaikhWasim Shaikh 7,04018 gold badges63 silver badges88 bronze badges 1
  • 1 try to reduce it to an example html + javascript you can include in your question. This will increase the chances of not getting your question closed. – Davy Landman Commented Sep 3, 2009 at 10:57
Add a ment  | 

2 Answers 2

Reset to default 5

Keith's version is a good approach, another, maybe more hacky way, of doing it is this:

$("#modal").animate({opacity:1}, 10000, function() {
    $(this).fadeOut();
});

This way, you can link up everything that needs to be done to the modal in one line...

There is a javascript function that allows you to carry out an action after a timeout:

setTimeout('$("#dialog").hide()', 10000);

Usually you're better off passing a function rather than the text to eval()

setTimeout(hideDialog, 10000);

function hideDialog() { $('#dialog').hide(); }

Or, if you want just one line:

setTimeout(function() { $('#dialog').hide(); }, 10000);
发布评论

评论列表(0)

  1. 暂无评论