jquery 缩放 4 个圆圈一个一个

标签 jquery css animation element

我试图实现一个一个地放大/缩小(或脉动)4 个圆圈的效果。例如脉冲 A,当 A 完成时脉冲 B..等等..

到目前为止,我的效果是每 4 秒脉冲一次,这很好。现在只是将它们分开。谁能帮我解决这个问题?

function pulseCircles() {
    if($(".header-banner .emo-faces").not(":hover")) {
        var $object = $(".header-banner .emo-faces");
        var delay = 4000;
        var delay2 = 2000;
            setTimeout(function() {
                $($object).addClass("pulse2");
                setTimeout(function() {
                    $($object).removeClass("pulse2");
                    pulseCircles();
                }, delay2);
            }, delay);
    }
};
pulseCircles();

编辑:

<div class="emo-faces">
    <a href="<?php echo get_tag_link(169); ?>" class="emj smile yellow icon-emo-happy"></a>
    <a href="<?php echo get_tag_link(167); ?>" class="emj suprise green icon-emo-suprised"></a>
    <a href="<?php echo get_tag_link(168); ?>" class="emj sad brown icon-emo-sad"></a>
    <a href="<?php echo get_tag_link(170); ?>" class="emj angry red icon-emo-angry"></a>
</div>

最佳答案

所以我设法做到了这一点:

function LoopZooming() {
    $(".emo-faces li").each(function(i) {
        var $li = $(this);
        var $prev = $(this).prev();

        $timer = setTimeout(function() {
            $prev.removeClass("pulse2");
            $li.addClass("pulse2");
            setTimeout(function() {
                if (i === 3) {
                    $li.removeClass("pulse2");
                }
            },2000);
        }, i*2000);
        $timer;
    });
};

var $interval = setInterval(LoopZooming, 10000);
$interval;

$(".emo-faces li").hover(
    function() {
        clearInterval($interval);
        StopLoopZooming();
    },
    function() {
        var $interval = setInterval(LoopZooming, 10000);
        $interval;
    }
);

关于jquery 缩放 4 个圆圈一个一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31760657/

相关文章:

javascript - 如果数据属性匹配 jQuery 则隐藏 div

iphone - 两个 UIViewController 之间的 3D 门打开动画

JQUERY 切换和 Ajax

PHP - 如何将 jquery dropdown.val() 插入 mysql 查询

Javascript:如何制作:当用户按下 Enter 键时,按下 Shift+Enter 即可进行内容编辑

c# - 如何读取 ASP.NET 中的 CSS 属性?

html - 如何将文本垂直对齐到图像的中间?

javascript - 在 Phaser 上显示带有间隔的 Sprite 图像

javascript - 在 google appmaker 中,无法使 requestAnimationFrame 工作

javascript - Angular JS路由不起作用