开发者

jQuery dialog box not in center in Chrome

in FF and Internet Explorer the dialog box shws up in the center, but in chrome it ends up on the left side.

How can i fix this?

code (self is the object this is in):

     $('form').live('submit',function(e){
            e.preventDefault();
            var $this = this;
            console.log('click submit')
  开发者_如何学Python          $('<div>',
                  {html: 'Are you sure you want to submit this table?<br/> All undo information will be lost.'})
             .dialog({
                modal: true,
                title: 'Are You Sure?',
                buttons: {
                    ok: function(){
                        $.get($this.action,$($this).serialize()+'&page='+self.pageOn,function(data){
                            console.log(data);
                            self.pageChanged = false;
                            self.origPage = $('#page').clone();
                            self.lastClick = $('#page').clone();
                        })
                        $(this).dialog('close');
                    },
                    cancel: function(){
                        $(this).dialog('close');
                    }
                },
                beforeClose: function(){
                    $(this).remove();
                }
            })

            return false;
        })


Perhaps assign a class to the dialog's div e.g:

 $('<div class="ui-dialogue">',
              {html: 'Are you sure you want to submit this table?<br/> All undo information will be lost.'})
         .dialog({
            modal: true,
            title: 'Are You Sure?',
            buttons: {

And then create include a css rule that will center the dialogue on the page like so:

.ui-dialogue{margin:0 auto;}

Or somesuch css that will center the dialogue... It's a guess, but might force it to work on most browsers.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜