javascript - 在父元素的动画完成后显示一个元素
问题描述
我想在其父元素的动画完成后显示一个元素。但是现在,我的导航项目显示在导航栏动画之前。像这样:下图
我在 jQuery 中尝试过 setTimeOut() 和 hide() 。但这对我不起作用(也许是因为我是 jQuery 新手)。这是我的代码
HTML:
<div class="nav-mini">
<div class="nav-mini-item">
<h2>About</h2>
</div>
<hr>
<div class="nav-mini-item">
<h2>Discover</h2>
</div>
<hr>
<div class="nav-mini-item">
<h2>Get Started</h2>
</div>
</div>
<div class="icn-wrapper">
<svg class="icn-ham" width="20" height="19" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" fill-rule="evenodd"><path d="M0 0h16v3H0zM0 6h16v3H0zM0 12h16v3H0z"/></g></svg>
</div>
<div class="icn-wrapper icn-close-wrapper">
<img class="icn-close" src="images/icon-close-menu.svg" alt="">
</div>
CSS:
.nav-mini {
z-index: 1;
border-radius: 10px;
width: 90%;
background-color: #fff;
position: absolute;
top: 90px;
left: 0;
right: 0;
margin: auto;
animation: topToBottom 0.3s ease-in;
}
JS:
var hamburger = $(".icn-ham")
var navbarMini = $(".nav-mini")
var iconClose = $(".icn-close-wrapper")
var navMiniItem = $(".nav-mini-item")
hamburger.click(function() {
navbarMini.show();
$(this).hide();
iconClose.show();
})
iconClose.click(function() {
navbarMini.hide();
$(this).hide()
hamburger.show();
})
解决方案
推荐阅读
- javascript - 混合内容:“https://localhost:44387/Home/Index”处的页面通过 HTTPS 加载,但请求了不安全的 XMLHttpRequest 端点
- database - PowerBI Server:由于网关配置问题,刷新失败
- cgi - 执行 DSPSMTF 以在浏览器上显示 stmf,但它都是垃圾,它正在下载文件而不是显示它。还有关于 CONTTYPES 文件的任何想法吗?
- git - 如果自上次合并后有新提交,则阻止 git merge
- node.js - 如何每次写入文件添加到新行?
- python - Python - 线程复制重复
- ios - 在快速触发 tableview 委托之前用函数更新局部变量
- php - PHP - 对 json 数组进行降序排序
- flutter - Flutter BlocProvider 无法分配给参数类型
- python - 安装 python-dev 和 python-pip 时出现 Python 依赖项错误