jquery animate不使用除线性之外的缓动

tus*_*ale 3 jquery easing jquery-animate

我已经写了jquery动画一个div,如果我没有提到任何缓和效果,或者如果我提到'线性',但我想在这里放松效果,我想要'easInOutBack',并且无法理解出了什么问题.

希望有人告诉我在哪里我错过了什么.

如果可能的话,请用简单的语言提供解决方案,因为我是jQuery的新手.:):|

$(document).ready(function (e) {
    $('div.button').on('click', function () {
        $('div.box').animate({
            marginLeft: 200
        }, {
            duration: 2000,
            easing: 'easeOutBack'
        });
    });
});  
Run Code Online (Sandbox Code Playgroud)

不适合我.

Moh*_*dil 6

您需要包含jquery UI

来自docs:

jQuery库中唯一的缓动实现是默认的,称为swing,以及一个以恒定速度进行的实现,称为线性.使用插件可以使用更多的缓动函数,尤其是jQuery UI套件.