gpt4 book ai didi

javascript - 如何只在点击而不是页面加载时使用 CSS 动画?

转载 作者:行者123 更新时间:2023-11-30 16:58:53 25 4
gpt4 key购买 nike

我正在使用 https://github.com/FezVrasta/bootstrap-material-design在我的元素中 更具体地说是复选框 这个问题集中在复选框组件上,整个库都在我的元素中使用。

<label class="control-label">
<div class="checkbox display-inline-block ">
<label>
<input type="checkbox" data-check="false" />
<span class="ripple"></span>
<span class="check"></span>
</label>
</div>
</label>

问题是复选框在页面加载时触发动画并且看起来很奇怪。 LESS 代码是 https://github.com/FezVrasta/bootstrap-material-design/blob/master/less/_checkboxes.less#L88在这里可以看到一个例子http://codepen.io/anon/pen/ogmgRX

有谁知道如何停止在页面加载时出现的动画?

最佳答案

如果您正在为 DOM 中的其他元素实例化它,为什么不使用类似的东西:

$('label').click(function() { 
$.material.checkbox();
});

参见 Example A .

或者,如果 checkbox 未被选中,则可能使用 CSS 禁用初始动画:

input[type=checkbox]:not(:checked) + .checkbox-material:before {
-webkit-animation: none !important;
-moz-animation: none !important;
-o-animation: none !important;
-ms-animation: none !important;
animation: none !important;
}

参见 Example B .

关于javascript - 如何只在点击而不是页面加载时使用 CSS 动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29216868/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com