Search code examples
jqueryeasingjquery-easing

jQuery animate() and easing type


I have this:

$('h1').animate({
    //stuff to be changed,
}, {
    duration: 1000, 
    queue: false
})

It doesn't accept when I change it to something like this:

{
    duration: 1000, 
    queue: false, 
    easing: easeOutBounce
}

When providing the easing as a string, I get this error:

Uncaught TypeError: n.easing[this.easing] is not a function

How should I place the easing type?


Solution

  • The easing should be a string, like so:

    {
        duration: 1000,
        queue: false,
        easing: 'easeOutBounce'
    }
    

    The API Docs on .animate() state:

    easing (default: swing)

    Type: String

    A string indicating which easing function to use for the transition.