简体   繁体   English

如何在另一个子div类的基础上向div类添加CSS属性?

[英]How to add css properties to a div class based on another child div class?

在此处输入图片说明

I have to apply below CSS only when this div class is available 我仅在此div类可用时才在CSS下应用

dhx_list_item dhx_list_day_events_item dhx_list_item dhx_list_day_events_item

.dhx_view .day_events .dhx_scroll_cont:first-of-type:before {
//some code here
}

Pls find the attached. 请找到附件。

With jquery, you could try something like this: 使用jquery,您可以尝试执行以下操作:

if ($('#child').length) {
    // manipulate the parent
    $('#parent').addClass('dhx_view');
}

$('#child').length will evaluate to false if none of the child div s are present. 如果没有任何子div ,则$('#child').length计算结果为false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM