_.throttle(function() {}, 250)
功能是否仅在click
上触发?因为我试图用一些延迟来运行一些代码,并且由于某种原因它似乎不工作。下划线的油门功能不会触发
return _.throttle(function() {
return ($(this).hasClass('dataRevealed')) ? $(this).addClass('animated fadeOut') : true;
}, 350);
编辑:功能如下:
Application.CardView.prototype.removeSimilarCards = function(_container) {
return $(_container).find('[data-identifier="card-view"]').each(function() {
console.log("first");
_.throttle(function() {
console.log("inner");
return ($(this).hasClass('dataRevealed')) ? $(this).addClass('animated fadeOut') : true;
}, 350);
});
};
为什么不使用window.setTimeout()出于同样的目的? – Raul
你怎么称呼那个功能?你期望得到延迟执行的结果吗? – Bergi
这个函数从(或者)到return的返回值在哪里? –