1252748
1252748

Reputation: 15362

jQuery UI dialog() fadeIn issue

jsFiddle : http://jsfiddle.net/loren_hibbard/ChXbr/

I'm trying to use the jQuery UI dialog box, but cannot figure out how to make it fadeIn when it appears and fadeOut when it is closed.

If I do something like this...

// Dialog           
$('#dialog').dialog({
   autoOpen: false,
   width: 600,
   modal: true,
   show: 'fadeIn(300)'
});

... then the modal sort of slides in with that weird jQuery effect where all the text inside is constantly having its justification and formatting adjusted. I'd like just a normal fade in where the content sort of smoothly materializes ( http://www.bennadel.com/resources/presentations/jquery/demo5/index.htm ).

Also, is there anyway to make the modal overlay a bit darker? And how come when I delete the paragraph of seemingly unrelated text, the modal stops working?

Upvotes: 4

Views: 6090

Answers (2)

j08691
j08691

Reputation: 207861

Try this:

$("#dialog").dialog({
    autoOpen: false,
    show: {
        effect: 'fade',
        duration: 2000
    },
    hide: {
        effect: 'fade',
        duration: 1000
    }
});

jsFiddle example of my code, and a jsFiddle using your code. BTW, in your example you have modal set to both true and false.

Upvotes: 20

Yohann
Yohann

Reputation: 136

You could try:

// Dialog           
$('#dialog').dialog({
   autoOpen: false,
   modal: false,
   width: 600,
   modal: true,
   show: function() {$(this).fadeIn(300);}
 });

Upvotes: 1

Related Questions