1
在jQuery中,我按顺序调用几个对话框来创建向导。尽管将位置设置为position: ["center", "center"]
,但对话框仍对齐左侧中心。jQuery UI对话框未正确对齐
该向导首先调用getMoreParams(0).
HTML中有7个div跨越moreParams [0-7]。
请让我知道是否需要更多的细节。 See video here.
代码是:
function getMoreParams(divNumber) {
$("#moreParams" + divNumber).addClass("isWizard");
$("#moreParams" + divNumber).dialog({
title: "Designing wizard",
width: "300px",
resizable: false,
position: ["center", "center"]
});
if (divNumber == 0) {
$("#moreParams" + divNumber).dialog({
modal: true,
position: ["center", "center"],
buttons: {
"Let's get started": function() {
getMoreParams(divNumber + 1);
$(this).dialog("close");
}
}
});
}
if (divNumber == 1) {
$("#moreParams" + divNumber).dialog({
modal: true,
position: ["center", "center"],
buttons: {
"Next": function() {
getMoreParams(divNumber + 1);
$(this).dialog("close");
}
}
});
}
if (divNumber > 1 && divNumber < 6) {
$("#moreParams" + divNumber).dialog({
modal: true,
position: ["center", "center"],
buttons: {
"Next": function() {
getMoreParams(divNumber + 1);
$(this).dialog("close");
},
"Previous": function() {
getMoreParams(divNumber - 1);
$(this).dialog("close");
}
}
});
}
if (divNumber == 6) {
$("#moreParams" + divNumber).dialog({
modal: true,
position: ["center", "center"],
buttons: {
"Save": function() {
$(this).dialog("close");
lastStep();
},
"Previous": function() {
getMoreParams(divNumber - 1);
$(this).dialog("close");
}
}
});
}
}
它在这里工作得很好。 divs在firefox和chrome中正确居中。看着视频(很好,btw :)),看起来'lastStep()'弹出的对话框正确居中。与由getMoreParams()'打开的对话相比,这个对话有什么不同? – 2010-06-24 21:33:09
同样在这里,你必须在你的javascript代码的其他部分有一些错误。在视频中,我们看到对话框弹出在中心,然后转到左边角落,所以试着找出产生这种效果的代码是什么。 – 2010-06-25 07:30:39