将备用CSS应用于jQueryUI对话框?

时间:2012-08-11 05:05:57

标签: jquery css jquery-ui themes

是否有一种直接的方法将一整套CSS应用于DOM树的一部分?例如,我有一个使用jQuery和jQueryUI来显示对话框的文档。对话框内容通过AJAX加载,因此它作为一个新的/单独的HTML元素树提供,我插入到< div>中。对话框。

基本上,我想要做的是将不同的jQueryUI主题应用于对话框内容。因此,例如,对话框标题栏和按钮将根据一个主题设置样式,但对话框内容(按钮,输入字段,滚动条,文本等)将根据不同的主题设置样式。

我想我可以为对话框内容中的所有类应用前缀,并为备用CSS选择器应用相同的前缀。有没有更简单的方法来实现这一目标?

1 个答案:

答案 0 :(得分:1)

http://jqueryui.com/download

在右侧,有一个列表菜单,该菜单中有一个选项

Advanced Theme Settings

深入研究,您将获得两个输入的下拉菜单。第一个允许你附加一个'css范围',这实际上是你想要的。请按名称命名。

同时

如果单击输入字段右侧的问号,它或多或少会准确描述您所说的内容。

This field allows you to specify a CSS scope to limit your theme to a particular portion of a page. This is helpful when using multiple themes on a page. If you don't provide a CSS scope, your theme will apply to all UI elements on a page.

继续......

In most situations, you won't need to specify a CSS scope. Please Note: If you provide a CSS scope, you will not get an example page included in your download.