Search code examples
jqueryjquery-animatedelayshowslide

Show and delay - jQuery, how use delay?


I have some problem with show and delay.. When I try add .delay to show function everything is wrong... Do you have any solutions how can I delaying function .show ? I looking for solutions on jQuery site but I wasn't find answer...

This function should be delaying:

$('#content').show("slide", { direction: "right", duration: 1000, easing: 'easeOutCirc' }, hideLoader());

Solution

  • delay() only works on animations which are queued on the element - which show() is not. Instead use setTimeout to run your function after a specified delay:

    var timeout = setTimeout(function() {
        $('#content').show("slide", { direction: "right", duration: 1000, easing: 'easeOutCirc' }, hideLoader());
    }, 2000); // 2000ms = 2 seconds