css - (仅限 CSS)动态创建新子代时更改父代
问题描述
有没有办法检测是否在只有 css(scss/sass) 的父级中创建了一个新子级?
我有以下代码
.toast-bottom-right:hover {
max-height: 40%;
}
.toast-bottom-right:not(:hover) > .toast-error:not(:first-child) {
display: none;
}
.toast-bottom-right:not(:hover){
animation: collapse 2s 1s forwards;
}
.toast-bottom-right {
max-height: 40%;
overflow-y: scroll;
-ms-overflow-style: none;
overflow: -moz-scrollbars-none;
}
.toast-bottom-right::-webkit-scrollbar {
display: none;
}
@keyframes collapse{
from {
max-height: 40%;
}
to {
max-height: 1.5%;
}
}
这会在悬停时弹出一个父元素(所有子元素),然后当悬停关闭所有子元素但第一个被隐藏时。一秒钟后,父级最大高度被设置为一个小尺寸(1.5%),这导致父级变成一个小条。然后可以将其悬停在其上。
我的目标是在添加新孩子时将父母的最大高度更改为其原始状态(40%),并且在 5 秒后重新开始悬停动画
具体的问题:有没有办法做到这一点,或者只有css(scss / sass)接近这个?
解决方案
推荐阅读
- r - 比较 tibble 中的嵌套行并仅检索唯一行
- azure-data-factory-2 - 如何在从开发人员移动到生产环境时在 Azure 数据工厂中动态更改管道级别的默认参数值
- android - 从 api 获取数据时未显示响应
- python - 使用 python 进行二进制读取会产生意想不到的结果
- shopify - ShopifyAPI::RecurringApplicationCharge api 的 403 禁止问题
- kate - 删除 Kate 中的尾随空格
- python - 如何使用另一个日期时间索引获取具有日期时间索引的 Pandas 数据框中的行?
- python - 如何计算组合的百分比?
- python - 我可以手动将输入神经元插入 Keras 的隐藏层吗?
- php - 使用 Windows 身份验证到 MSSQL 服务器的 PHP 应用程序