jQuery UI Dialog individual CSS styling(jQuery UI Dialog 个人 CSS 样式)
问题描述
我希望使用与传统对话框不同的独特 CSS 来设置模式对话框(使用 UI 对话框)的样式,因此本质上是有两个看起来不同的 jQuery 对话框.
I'm looking to style a modal dialog (using UI Dialog) with unique CSS that is separate from the traditional dialog, so in essence to have two jQuery dialogs that each look different.
例如,我已经设计了一个样式,
I've styled one, for example,
<div id="dialog_style1" class="dialog1 hidden">One content</div>
还有一个
<div id="dialog_style2" class="dialog2 hidden">Another content</div>
不幸的是,我注意到使用单独的 CSS 来设置对话框部分的样式,例如
Unfortunately I've noticed that using separate CSS to style parts of the dialog box, like
.dialog1 .ui-dialog-titlebar { display:none; }
.dialog2 .ui-dialog-titlebar { color:#aaa; }
不起作用,因为 .ui-dialog-titlebar
没有类 .dialog1
,我不能做 addClass
无需闯入插件.
doesn't work because .ui-dialog-titlebar
does not have the class .dialog1
, and I can't do an addClass
either without breaking into the plugin.
另一种方法是让像 body
这样的元素有一个唯一的类/ID(取决于我想要哪个),但这会阻止两个对话框在同一页面中.
An alternative would be to have an element like body
have a unique class/id (depending on which one I want), but that would preclude having both dialogs in the same page.
我该怎么做?
推荐答案
在 Ajax:
$(".ui-dialog-titlebar").hide();
$(".ui-dialog").addClass("customclass");
这仅适用于打开的对话框,因此可以针对每个使用的对话框进行更改.
This applies just to the dialog that is opened, so it can be changed for each one used.
(此快速回答基于 Stack Overflow 上的另一个响应.)
(This quick answer is based on another response on Stack Overflow.)
这篇关于jQuery UI Dialog 个人 CSS 样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:jQuery UI Dialog 个人 CSS 样式


- Fetch API 如何获取响应体? 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 失败的 Canvas 360 jquery 插件 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01