我已經構建了一個js對話框來充當顏色選擇器。一切運行良好,除了當用戶選擇顏色色板時,我似乎無法設置對話框標題欄的顏色。JavaScript在對話框加載後設置對話框標題欄顏色
還希望得到一個如何停止從被調暗,不透明度設爲所以會出現昏暗稱爲對話框的父窗口。
當用戶在對話框內選擇顏色樣本的對話外一個函數被調用,以暫時設置的主叫窗口的顏色。代碼如下:
function changeColor(themeColor) {
// set colors on parent window that called the dialog
$("#top-wrapper").css("background-color", themeColor);
$("#md-page-head").css("background-color", themeColor);
$("#bottom-wrapper").css("background-color", themeColor);
// looking for code that would go here to set the dialog's title bar color
// have tried various iterations to no avail
}
對話框的代碼如下所示:
$('#qktheme').dialog({
width: 500,
resizable: false,
show: 'slide',
autoOpen: false,
modal: true,
buttons: [{
text: "Save",
tabIndex:-1,
'class':'dialog3_buttons',
click: function(event) {
// save the new theme color choice - to be coded
$(this).dialog("close");
return true;
}
}, {
text: "Cancel",
tabIndex:-1,
'class':'dialog3_buttons',
click: function(event) {
// put back the original theme color - to be coded
$(this).dialog("close");
return false;
}
}]
})
.height("auto");
如果你不想背景使用'modal:false'。不太清楚顏色應該如何工作 – charlietfl
謝謝 - 這對於次要問題非常適用。非常感激。 – Tim