我想显示扬声器的波浪动画。扬声器发出 3 个波。我想这样展示:-
1st wave will be shown in 1 sec,
2nd wave will be shown in 2 sec,
3rd wave will be shown in 3 sec,
and then all waves will be disappear and it will start again.
我尝试了以下代码:-
$('.waves1').hide();
$('.waves2').hide();
$('.waves3').hide();
$('.waves4').hide();
function waveIt(element, times, klass, delay)
{
for (var i = 0; i < 1000; i++) {
setTimeout(function () {
$(element).show();
}, delay + (300 * i));
};
};
waveIt('.waves1', 10, 'i_waveflash1', 1000);
waveIt('.waves2', 10, 'i_waveflash2', 2000);
waveIt('.waves3', 10, 'i_waveflash3', 3000);
它最初在 1 秒间隔后逐个显示,但完成后它不会再次启动。我想再次启动它。对不起我的英语不好,任何帮助将不胜感激。