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