GiGa
GiGa

Reputation: 41

How to determine the execution time of a jQuery script?

I found an interesting script (link) but it runs only once after the document was loaded, how do I run the script every time I see it? Thanks guys.

jQuery(document).ready(function($){
    setTimeout(function(){
         $('.trans--grow').addClass('grow');
    }, 275);
});

Upvotes: 0

Views: 294

Answers (1)

P.S.
P.S.

Reputation: 16384

You can wrap this code into another function like this:

function yourFunction (delayMs) {
    setTimeout(function() {
        $('.trans--grow').addClass('grow')
    }, delayMs)
}

And invoke this function whenever you want via yourFunction(275).

Upvotes: 1

Related Questions