jQuery对话框不在Chrome中居中 [英] jQuery dialog box not in center in Chrome
本文介绍了jQuery对话框不在Chrome中居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我该如何解决这个问题?
代码( self
是此对象的对象):
live('submit',function(e){
e.preventDefault();
var $ this = this;
$('form'
console.log('点击提交')
$('< div>',
{html:'您确定要提交此表吗?< br /> ')
.dialog({
modal:true,
title:'你确定吗?',
按钮:{
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;
})
解决方案
对话框的div例如:
$('< div class =ui-dialogue>',
{html:'您确定要提交此表吗?< br />所有的撤消信息都将丢失。'})
.dialog({
modal:true,
title:'你确定?',
按钮:{
然后创建include css规则,它会将对话集中在页面上,如下所示:
.ui-dialogue {margin:0 auto;}
或者其他一些会将对话中心的css ...
这是一个猜测,但可能会强制它在大多数浏览器上工作。
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')
$('<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.
这篇关于jQuery对话框不在Chrome中居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文