auto-animate实现dom元素增删改增加自动动画效果代码
代码语言:html
所属分类:动画
代码描述:auto-animate实现dom元素增删改增加自动动画效果代码,只要一行代码就能让原本对dom元素的增加、删除、显示、隐藏自动增加动画过渡效果。
代码标签: auto-animate dom 元素 增 删 改 增加 自动 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> html, body { display: grid; height: 100%; background-color: #f8f8f8; } * { margin: 0; box-sizing: border-box; font-family: sans-serif; } .reminder-list { align-self: start; align-items: start; list-style: none; padding: 0.5em; display: grid; gap: 0.5em; } .reminder-item { background-color: #fff; padding: 1em; display: flex; align-items: center; border-radius: 0.5em; border: 1px solid #ccc; gap: 1em; } .reminder-item__wait-time { --text-color: #555; --bg-color: #fbf4dd; color: var(--text-color); background-color: var(--bg-color); padding: 0.5em 0.75em; border-radius: 1em; font-size: 0.85em; transition: 0.2s ease-out color, 0.2s ease-out background-color; } [data-wait-time="0"] .reminder-item__wait-time { --text-color: #fff; --bg-color: #cd1818; } .reminder-item__controls { margin-left: auto; display: flex; gap: 0.5em; } button { --accent: #107e55; appearance: none; border: 1px solid var(--accent); border-radius: 0.5em; color: var(--accent); cursor: pointer; padding: 0.75em; padding-bottom: 0.6em; background: transparent; font-weight: bold; transition: 0.2s ease-out color, 0.2s ease-out background-color; } button:hover { background-color: var(--accent); color: white; } .reminder-item__snooze { --accent: #8c3303; } </style> </head> <body> <ul class="reminder-list"> <li class="reminder-item" data-wait-time="0"> Harvest Garlic Scapes <span class="reminder-item__wait-time">Due Now</span> <div class="reminder-item__controls"> <button type="button" class="reminder-item__complete">Complete</button> <button type="button" class="reminder-item__snooze">Snooze</button> </div> </li> <li class="reminder-item" data-wait-time="0"> Water Heather's Garden <span class="reminder-item__wait-time">Due Now</span> <div class="reminder-item__controls"> <button type="button" class="reminder-item__complete">Complete</button> <button type="button" class="reminder-item__snooze">Snooze</button> </div> </li> <li class="reminder-item" data-wait-time="0"> Return Books to Library <span class="reminder-item__wait-time">Due Now</span>.........完整代码请登录后点击上方下载按钮下载查看
网友评论0