只开一次活动? [英] Only fire an event once?
本文介绍了只开一次活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何控制只触发一次事件?
How do I control only firing an event once?
实际上,快速谷歌似乎暗示.one帮助..
Actually, a quick google appears to allude to the fact that .one helps..
推荐答案
您可以使用jQuery的 一个
方法,它只会订阅第一次出现的事件。
例如:
You can use jQuery's one
method, which will subscribe to only the first occurrence of an event.
For example:
$('something').one('click', function(e) {
alert('You will only see this once.');
});
这篇关于只开一次活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文