如何使按钮无限闪烁,但可以随时停止
我需要使按钮在其他元素触发后开始闪烁,例如选中复选框 - 请参阅下面的代码:
<label>I agree with the terms</label>
<input class="some_check" type="checkbox" id="Signed">
<button class="buttonstyle" name="buttonNext" onClick="nextChoose('NEXT')" disabled>Proceed!</button>
闪烁必须是无限的,直到:
- 用户单击按钮或
- 取消选中复选框。
我知道 jQuery UI 中有 .effect()
方法,但它是有时间限制的 如果我通过回调循环它,我如何才能将其中断以返回先前状态的按钮?
I need to make button to start blinking after some other elemment trigered it, for example checking the checkbox - see the code below:
<label>I agree with the terms</label>
<input class="some_check" type="checkbox" id="Signed">
<button class="buttonstyle" name="buttonNext" onClick="nextChoose('NEXT')" disabled>Proceed!</button>
Blinking must be infinite until:
- user clicks the button or
- unchecks the checkbox.
I know there's .effect()
method in jQuery UI, but it's time-limited
and if I loop it through the callback, how than I can break it to return button in a previous state?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您正在寻找类似的东西 THIS FIDDLE
CSS:
JavaScript:
HTML:
Maybe your looking for something like this THIS FIDDLE
CSS:
JavaScript:
HTML:
您可以使用
setInterval
使某些事情一遍又一遍地发生,然后在其返回值上调用clearInterval
使其停止。 这是一个可以帮助您入门的示例。You can use
setInterval
to make something happen over and over again, and later callclearInterval
on its return value to make it stop. Here's a working example to get you started.