Javascript 设置一个 Jquery 对话框标题栏样式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11453466/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 05:52:12  来源:igfitidea点击:

Set a Jquery dialog title bar style

javascriptjquerycssjquery-uijquery-ui-dialog

提问by anmarti

I want that some of my jquery dialogs, not all, have a different title bar color. How can I acheive this? I used the property dialogClass:"myClass" in desired dialogs but this doesen't change the title bar, just the dialog body.

我希望我的一些 jquery 对话框(不是全部)具有不同的标题栏颜色。我怎样才能做到这一点?我在所需的对话框中使用了属性 dialogClass:"myClass" 但这并没有改变标题栏,只是改变了对话框正文。

Thank you!!

谢谢!!

回答by Gustav Barkefors

Specifying a dialogClassadds this class to the outermost divwrapping the entire dialog including the title bar, so you just have to make sure that you CSS rule is targeting the correct element. For instance:

指定 adialogClass会将此类添加到div包装整个对话框(包括标题栏)的最外层,因此您只需确保 CSS 规则针对正确的元素。例如:

.myDialogClass .ui-widget-header {
  background: purple;
}

回答by Drakkainen

You could do:

你可以这样做:

   div#myDialog .ui-dialog-titlebar {
      background-color: red;
   }

The .ui-dialog-titlebaris what you are looking to apply your style to.

.ui-dialog-titlebar就是您希望将您的风格应用到的。

回答by Todd Hiltz

div.ui-widget-header {
  border: 1px solid #3b678e;
  background: #3b678e url("images/ui-bg_gloss-wave_35_3b678e_500x100.png") 50% 50% repeat-x;
  color: #ffffff;
  font-weight: bold;
}