Yavana
Yavana

Reputation: 411

After triggering how to get a 5 sec delay

Here is my question I am triggering a click for a particular function after this trigger I need 5 Sec delay before the next click click inside the condition here is my code

$('.history .enter').trigger('click');
if( peCount != 7) {
    $('.btn_physical').trigger('click');
    $('.black_bg').fadeIn(300);
}

Somebody please help.

Upvotes: 1

Views: 79

Answers (2)

A. Wolff
A. Wolff

Reputation: 74420

You can use queue and delay, be aware a delay cannot be reseted.

$('.btn_physical').clearQueue().delay(5000).queue(function(){$(this).trigger('click');});

Upvotes: 0

Adil
Adil

Reputation: 148180

You can use setTimeout, to put delay.

$('.history .enter').trigger('click');
if( peCount != 7) {
    $('.btn_physical').trigger('click');
    setTimeout(function(){
       $('.black_bg').fadeIn(300);
    }, 5000);
}

Upvotes: 2

Related Questions