html - 如何为先前选择的项目应用动画
问题描述
我有一个单选按钮,并且能够在按钮单击时获得动作/动画。以及如何从单选按钮组中为先前选择的项目添加动画。
代码受到打击,
function radiobtn_clicked(radiobtn){
console.log(radiobtn.value)
}
.toggle-triple-switch label {
display: inline-block;
height: 30px;
width: 50px;
position: relative;
border: 2px solid;
justify-content: center;
}
.toggle-triple-switch .toggle-triple-switch__input:checked + .toggle-triple-switch__label{
color: #FFFFFF;
background-color: green;
transform: scale(1);
}
<div class="toggle-triple-switch" id="time-selector" dir="auto">
<input type="radio" id="time-now"class="toggle-triple-switch__input" name="time-select" value="now"
checked onclick="radiobtn_clicked(this)"/>
<label for="time-now" class="toggle-triple-switch__label" id="now-label"></label>
<input type="radio" id="time-yesrtay" class="toggle-triple-switch__input" name="time-select" value="yesterday"
checked onclick="radiobtn_clicked(this)"/>
<label for="time-yesrtay" class="toggle-triple-switch__label" id="ysterday-label"></label>
<input type="radio" id="time-tomorrow" class="toggle-triple-switch__input" name="time-select" value="tomorrow"
checked onclick="radiobtn_clicked(this)"/>
<label for="time-tomorrow" class="toggle-triple-switch__label" id="tomorrow-label"></label>
</div>
解决方案
推荐阅读
- azure-webjobs - 如何将 azure webapp ip 地址添加到存储帐户中的白名单
- mysql - 错误 1045 - 访问我的 mysql 数据库的一个大问题
- .net - .Net 应用程序的 Windows 安装程序包生成器,提供其他软件下载
- c# - 将 XML 字符串 API 响应转换为键值对象 C#
- python - 使用基于两列的 if 条件更新数据框
- nim-lang - 如何在 Nim 中编写异步代码以由计时器定期调用?
- react-native - 如何在axios文件中调用useNavigation
- javascript - 无法通过 Nodejs 中的用户池返回的令牌访问身份池
- algorithm - T(n) = T(3n/4) + 2T(n/2) + n 的复杂度是多少?
- python-3.x - 在 scrapyd 中,如何通过 schedule api 传递 FEED_URI 值