views:

1806

answers:

2

I have a JQuery UI dialog which is modal and has a black background with 50% opacity. Is it possible to make the background opacity fade from 0% to 50%? If so, how? Because currently it feels kind of like getting a punch straight to the face when a dialog is shown.

FWIW, this is the CSS I'm using at the moment:

.ui-widget-overlay {
    background: black;
    opacity: 0.5;
    filter: alpha(opacity = 50);
    position: absolute;
    top: 0;
    left: 0;
 }
A: 

I guess this can help you out, skorpan http://docs.jquery.com/Effects/fadeTo#speedopacitycallback

sshow
Perfect, I can't believe I didn't think of that!
Deniz Dogan
I have experience in reading manuals =)
sshow
+1  A: 

You could also add this to fadeIn the modal:

$(loginForm).dialog({
        resizable: false,
        open: function(){
            $('.ui-widget-overlay').hide().fadeIn();
        },
        show: "fade",
        hide: "fade" 
});

Hope this helps :)

Sam Barnes