创建一个脉动的圆圈

时间:2015-02-23 15:28:34

标签: javascript jquery animation

I found a jsfiddle with a working pulsating circle (jQuery 1.8.5 edge)

我的代码完全相同。

function addCircle() {
        //var rad = $(window).width();
        var $circle = $('<div class="circle"></div>');
        $circle.animate({
            'width': '300px',
            'height': '300px',
            'margin-top': '-150px',
            'margin-left': '-150px',
            'opacity': '0'
        }, 4000, 'easeOutCirc');
        $('body').append($circle);

        setTimeout(function __remove() {
            $circle.remove();
        }, 4000);
    }
    addCircle();
    setInterval(addCircle, 1200);

它不适用于jQuery 1.11.x. 控制台错误很简单:

  

jquery.min.js:4 Uncaught TypeError:undefined不是函数

The same jsfiddle with the latest jquery (1.11.0)

我需要改变什么?谢谢!

1 个答案:

答案 0 :(得分:3)

您必须添加支持easeOutCirc的jQuery UI或easing library,jQuery本身不支持该缓动

FIDDLE

相关问题