开发者

Jquery dialog to open multiple windows

开发者 https://www.devze.com 2023-01-21 21:38 出处:网络
I\'m trying to make system of multiple dialogs in one page using jquery dialog... Functions looks like...

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 se开发者_开发技巧e 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?


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');
}
0

精彩评论

暂无评论...
验证码 换一张
取 消