弹出jquery中标题栏的颜色

时间:2015-04-13 14:37:44

标签: javascript jquery css

试图将jquery pop中标题栏的背景颜色更改为绿色(在jsfiddle中看作蓝色)......似乎无法得到它......欢迎任何建议?

    $("#dia").dialog({
    autoOpen: true,
    title:"Access Point",
    height: 200,
    width: 300,
    modal: false,
    draggable: true,
    position: [900, 150],
    dialogClass: "foo",
    //show: {effect: 'bounce', duration: 350, times: 3}
    show: {effect: 'fade', duration: 2000}
});

$(".ui-dialog-titlebar").css("background-color", "green");
$(".ui-dialog").css("background-color", "green");
$(".ui-dialog-title").css("background-color", "green");
$(".ui-dialog-content").css("background-color", "green");

请参阅http://jsfiddle.net/dEvKb/3254/

3 个答案:

答案 0 :(得分:0)

在标题栏中应用渐变,就像背景图片一样,您必须重置它。

$(".ui-dialog-titlebar").css("background", "green");

$(".ui-dialog-titlebar").css({'background-color': 'green', 'background-image': 'none'});

答案 1 :(得分:0)

这是因为默认对话框标题有背景图像。尝试将其更改为以下代码:

$(".ui-dialog-title").css("background", "green");
$(".ui-dialog-titlebar").css({"background": "green", "border": "none"});

看到这个小提琴:

http://jsfiddle.net/dEvKb/3258/

答案 2 :(得分:0)

您无需使用JS更改背景颜色。

CSS WAY (raccomanded)

.ui-widget-header,.ui-dialog-titlebar,.ui-dialog,.ui-dialog-title,.ui-dialog-content{
    background: none green;
}

示例:http://jsfiddle.net/dEvKb/3257/

JS WAY

$(".ui-widget-header,.ui-dialog-titlebar,.ui-dialog,.ui-dialog-title,.ui-dialog-content").css("background", "green");

示例:http://jsfiddle.net/dEvKb/3259/