jQuery - UI Dialog - looking for a smart solution for a timed close

Posted by AnApprentice on Stack Overflow See other posts from Stack Overflow or by AnApprentice
Published on 2011-01-15T19:39:11Z Indexed on 2011/01/15 19:53 UTC
Read the original article Hit count: 245

Filed under:
|
|

Hello, I wrote the following:

// Called with setTimeout(magicDialogDelayedClose, 2500);
function magicDialogDelayedClose() {
    $(".ui-dialog").fadeOut(function() {
        dialog_general.dialog('close');
    }); 
}

The above is called with setTimeout when I show a notice dialog that I want to auto close in 2.5 secs.

The problem I'm noticing with this is that if the use Manually closes a dialog this timer still is running. If the user then opens a new dialog (which is very possible) the timer can then close that NEW dialog.

What's a smart way to handle this?j

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui