Tom
Tom

Reputation: 16236

JQuery Dialog Show Hide effects

I am trying to do this:

$('#mypopup').dialog({
    modal: true,
    autoOpen: true,
    resizable: false,
    show: {effect:'slide',duration:250},
    hide: {effect:'slide',duration:250}
});

then to open it ...

function showPopup() {
        if ($('#mypopup').length == 0) {
            $('#mypopup-div').load('mypopupurl/show.php'); 
        } else {
            //reopen the login dialog previously rendered, don't load again
            $('#mypopup').dialog('open'); 
        }
    }

then to close it ...

$('#mypopup').dialog('close');

My problem is, the show slide effect in the code above only works the first time, when it actually loads from .load('mypopupurl/show.php'); When I close it and re-open the popup dialog, it hits the else statement with the .dialog('open'); code, this time the slide effect does not happen. (not error, just pops up as normal, but no effect)

Is this a glitch in JQuery? Or is it by design? How do I make the effect work when it hits dialog('open')?

Upvotes: 0

Views: 2765

Answers (1)

Luke Alderton
Luke Alderton

Reputation: 3296

I think you can do something like $('#mypopup').show(); or $('#mypopup').dialog().show();

Upvotes: 1

Related Questions