jQuery UI的对话框上的不同背景

时间:2022-11-29 21:00:21

I need to make 3 different backgrounds for some dialog box. First, i don't want the "common" title on the dialog box, i removed it.
i want to use a simple background-image instead of the css proposed by the jquery css. Nonetheless, i used the jquery css and added background-image to .ui-dialog. how do i change the background-image on the 'iu-dialog' with js?

我需要为一些对话框制作3个不同的背景。首先,我不希望对话框中的“常用”标题,我删除它。我想使用简单的背景图像而不是jquery css提出的css。尽管如此,我使用jquery css并将背景图像添加到.ui-dialog。如何使用js更改'iu-dialog'上的背景图像?

2 个解决方案

#1


1  

You could add a class to it, either manually or using jQuery in case you wanted to have a series of the same-looking dialogs:

你可以手动或使用jQuery为它添加一个类,以防你想拥有一系列相同的对话框:

$('.selector').addClass("dialog_alt");

Then throw the background-image into the css, make it important?

然后将背景图像投入css,重要吗?

.dialog_alt{
    background-image: url(image.png) !important;
}

#2


0  

If you want to change the background-image via JavaScript/jQuery you can do it with:

如果你想通过JavaScript / jQuery更改背景图像,你可以使用:

$('.ui-dialog').css('background-image', 'some/image.png').

$('。ui-dialog')。css('background-image','some / image.png')。

More information about .css()

有关.css()的更多信息

#1


1  

You could add a class to it, either manually or using jQuery in case you wanted to have a series of the same-looking dialogs:

你可以手动或使用jQuery为它添加一个类,以防你想拥有一系列相同的对话框:

$('.selector').addClass("dialog_alt");

Then throw the background-image into the css, make it important?

然后将背景图像投入css,重要吗?

.dialog_alt{
    background-image: url(image.png) !important;
}

#2


0  

If you want to change the background-image via JavaScript/jQuery you can do it with:

如果你想通过JavaScript / jQuery更改背景图像,你可以使用:

$('.ui-dialog').css('background-image', 'some/image.png').

$('。ui-dialog')。css('background-image','some / image.png')。

More information about .css()

有关.css()的更多信息