English 中文(简体)
jQuery Show Dialog Modal Animation Happens while Background Dimmed
原标题:

This is an annoyance that I ve tolerated for too long, and finally decided to pursue an answer. I am showing a modal jQuery dialog box in my web app, but the animation to show it doesn t occur in the right order. I m setting a click event (using jQuery) to a link on a page, and when the user clicks it, it creates a new Dialog, with autoOpen set to true. Cancel from the dialog destroys it so that the user can open it again on the next click.

No matter what animation I use (currently using "blind"), it seems like the whole page dims first, then opens the dialog box (still dimmed), and once the dialog box has completely opened, it undims it. Just not happening in the right order. Has anyone else seen this, or know why this might be happening? Code I m using to create dialog is below:

function setDialogWindows($dialogDiv, $leftList, $rightList, leftArray, rightArray, $htmlItemList) {

    $dialogDiv.dialog({
        autoOpen: true,
        modal: true,
        show:  blind ,
        hide:  blind ,
        width: 600,
        resizable: false,
        buttons: {
            Cancel: function() {
                resetDialog($leftList, $rightList);
                $(this).dialog( destroy );
            },
             Save : function() {

                if (saveDialog($leftList, $rightList, leftArray, rightArray, $htmlItemList)) {
                    showHideItemList("show");
                }
                else
                    showHideItemList("hide");

                $(this).dialog( destroy );
            }
        }
    });
}

Any help would be appreciated. Thanks.

最佳回答

I was able to get this to display correctly within IE and FireFox where the page was dimmed and the dialog animation completed correctly (non-dimmed). Do you have any other jQuery script that s acting on that <div> tag?

EDIT: I was just able to recreate this issue. It would seem that it s an issue with the initial displaying of the dialog box combined with an animation. In your case, because your constantly creating/destroying the dialog this would appear every time. Here s something you might want to try:

function setupDialog($dialogDiv) {
    // set autoOpen: false
    // within Cancel and Save use .dialog( close )
}

// Define the dialog boxes:
setupDialog($( #dialog1 )); 
setupDialog($( #dialog2 )); 
setupDialog($( #dialog3 )); 

// Show the dialog on button clicks:
$( #button1 ).click(function() {
    $( #dialog1 ).dialog( open );
});
$( #button2 ).click(function() {
    $( #dialog2 ).dialog( open );
});
$( #button3 ).click(function() {
    $( #dialog3 ).dialog( open );
});
问题回答

暂无回答




相关问题
images sliding continuously with <table> and jQuery

I m trying to write a little test page that circulates images through a window (see image). I have colored boxes inside a table (gray border), with each box being a element. <table id="boxes" ...

WPF 3d rotation animations

I have a few 3d rectangles on my screen that I want to pivot around the Y axis. I want to press down with the mouse, and rotate the 3d object to a max rotation, but when the user moves their mouse, ...

Disable Windows 7 touch animation in WPF

In Windows 7 when you touch the screen there is a short animation that occurs at the touch point. In my WPF app I want to display my own touch points, without showing the one supplied by Windows. ...

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Direct 2D gnuplot PNG animation?

Can anyone please confirm that yes/no Gnuplot 4.5 (on CVS) can output 2D animated PNG files? I have numerous datasets but one line that I d like to show iteratively in 3 different places in my graph. ...

Visual State Manager VS Animations in WPF

There is a lot of talk about the simplicity of Visual States and the transitions between them in WPF/Silverlight. I have the need to generate animations dynamically at runtime, to animate the ...

Create a ImageIcon that is the mirror of another one

I ll like to know if there is a way to create a ImageIcon that is the mirror of another ImageIcon. Searching on Google, I found how to do it by using many AWT libraries. Is there a way to do it with ...

how to drag in the animation in iphone application?

Iphone application is using the static co-ordinates to reach at some points in the application,which is based on the button event. But what i want is when i drag the item than it should reach at some ...

热门标签