amit gupta
amit gupta

Reputation: 1330

animated multiple jquery ui dialog box on click

I have jquery ui dialog box, and I want to Animate multiple dialog boxes on single click. But it animate only inner boxes div inside the complete dialog box.anyone let me know how to do this ? I've done this: Fiddle DEMO

//Script

     $("#animate").click(function() {      

     $('#dialog').animate({
         left: "50px",
            });
     $('#dialog2').animate({
         top: "100px",
            });
 });

Upvotes: 1

Views: 730

Answers (1)

shanabus
shanabus

Reputation: 13115

@Joe almost had it, but I think the ui-dialog selector will animate both of the dialogs when you actually have two different animations. Try this:

$('#dialog').parents(".ui-dialog").animate({
             left: "50px",
                });
$('#dialog2').parents(".ui-dialog").animate({
             top: "100px",
                });

     });

That uses the .parents() selector method to move the appropriate dialogs.

Working example here: http://jsfiddle.net/wKcDP/44/

Upvotes: 2

Related Questions