0
我想爲當前在窗口中的每個元素添加一個類,並在多米諾效應之間延遲。jQuery addClass延遲到可見元素
我已經做了延遲很好,但增加了類到所有匹配的元素,而不僅僅是在視圖中。
$(document).ready(function() {
$('.box').each(function(i){
if($(this).scrollTop() <= $(window).scrollTop() + $(window).height()) {
var tile = $(this);
setTimeout(function() {
tile.addClass('visible');
}, 500*i);
};
});
});
你看着jQuery中的'delay'? – funcoding