简体   繁体   English

jQuery对话框不在Chrome中居中

[英]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. 在FF和Internet Explorer中,对话框在中间居中显示,但在chrome中,该对话框在左侧结束。

How can i fix this? 我怎样才能解决这个问题?

code ( self is the object this is in): 代码( selfself在的对象):

     $('form').live('submit',function(e){
            e.preventDefault();
            var $this = this;
            console.log('click submit')
            $('<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 eg: 也许给对话框的div分配一个类,例如:

 $('<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: 然后创建一个包含css规则,该规则将对话框集中在页面上,如下所示:

.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. 或某种以对话为中心的CSS……这是一个猜测,但可能会迫使其在大多数浏览器上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM