更新时间:2023-12-05 15:58:22
如何使用setTimeout
控制事件的触发-如:
How about using setTimeout
to control the firing of events - as:
$("div").html((new Array(1000)).join(" test")).on("mousewheel DOMMouseScroll MozMousePixelScroll", function()
{
if (!$(this).data('flag'))
{
var self = this;
$(this).data('timeout', window.setTimeout(function()
{
$(self).data('flag', false);
}, 500));
$(this).data('flag', true);
console.log('here');
}
});