Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 431
1252748 Avatar asked Nov 30 '22 15:11

1252748


2 Answers

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.

like image 177
j08691 Avatar answered Dec 05 '22 18:12

j08691


You could try:

// Dialog           
$('#dialog').dialog({
   autoOpen: false,
   modal: false,
   width: 600,
   modal: true,
   show: function() {$(this).fadeIn(300);}
 });
like image 43
Yohann Avatar answered Dec 05 '22 19:12

Yohann