【发布时间】:2018-07-10 07:27:47
【问题描述】:
我未能在 javascript 中使用点击功能。如何添加淡入类点击事件?如果可能的话,使用现代 javascript 或 es6。另外,如何在 5 秒内删除课程?请建议我不要使用 JQuery。
如果可能,所有点击事件方法函数都使用。
我未能在 javascript 中使用点击功能。如何添加淡入类点击事件?如果可能的话,使用现代 javascript 或 es6.Also,如何在 5 秒内删除该类?请建议我不要使用 JQuery。 如果可能,所有点击事件方法函数都使用。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>css layout</title>
<style>
#container {
width: 400px;
height: 400px;
position: relative;
background: yellow;
}
#animate {
width: 50px;
height: 50px;
position: absolute;
background-color: red;
}
@-webkit-keyframes fadeIn {
to {
opacity: 1;
}
}
@keyframes fadeIn {
to {
opacity: 1;
}
}
.fade-in {
-webkit-animation: fadeIn .5s ease-in 1 forwards;
animation: fadeIn .5s ease-in 1 forwards;
opacity: 0;
}
</style>
</head>
<body>
<!--button-->
<p>
<button onclick="animations()">Click Me</button>
</p>
<div id="container">
<div id="animate"></div>
</div>
<!--js-->
<script>
function animations() {
var elem = document.getElementById("animate");
}
</script>
</body>
</html>
【问题讨论】:
标签: javascript animation animate.css