Skip to content Skip to sidebar Skip to footer

Jquery: Two Animate() Functions On One Click. Delay() Problem?

hey guys, i have a weird and probably rare problem. The following function is called when a link is clicked. $(selector).delay(500).animate({ backgroundColor: '#ccc' }, 300).delay(

Solution 1:

Animations are queued by default. If you do not want your animations queued you can specify it in the options for .animate( properties, options )

queue: A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately.

Putting that with your example, it might look something like this:

$(selector).animate({
    'height': '450px'
     },{
    duration: 'fast',
    complete: function () {
        console.log('has a delay')
    },
    queue: false
});

Code example showing the queue behavior on jsfiddle.

Post a Comment for "Jquery: Two Animate() Functions On One Click. Delay() Problem?"