2

I'm trying to make system of multiple dialogs in one page using jquery dialog...

Functions looks like...

 function open_w(id){

         $('.opened').dialog('close');
         $(id).addClass('opened');
         $(id).dialog({position: 'center',  modal:true, width: '750px' });
           };


     function close_w(){
     $('.opened').dialog('close');
     $('.opened').removeClass('opened');
      };

As you see passing the ID opens me that windows, but before open close me old windows.. When i open it fist time everything is good.. But Next time it's doesn't want open

Where is mistake?

1 Answer 1

1

It's because you're trying to re-create the dialog, instead of this every time:

$(id).dialog({position: 'center',  modal:true, width: '750px' });

You need to call open (on the already created dialog), like this:

$(id).dialog('open');

For example:

function open_w(id){
  close_w();
  $(id).addClass('opened')
       .dialog({position: 'center',  modal:true, width: '750px' })
       .dialog('open');
}
function close_w() {
  $('.opened').dialog('close').removeClass('opened');
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.