Reputation: 1108
In my game I have added a snowflake icon to freeze the time for 3 seconds. I have added this to the script
$(".character").click(function() {
if ($(this).hasClass("freeze")) {
$('#timer').delay(3000);
}
Any ideas why it will not work?
Here is a fiddle.. http://jsfiddle.net/pUwKb/30/
Upvotes: 1
Views: 164
Reputation: 26719
You missunderstood delay. You have to clear the countdown interval, and set timeout after which the countdown interval will be activated again
$(".character").click(function() {
if ($(this).hasClass("freeze")) {
window.clearInterval(countdown);
window.setTimeout(function(){
countdown = window.setInterval(...)
}, 3000);
}
and you'll have to name the function in order to do so
as for the $.delay it's used to delay execution of jQuery animations
Upvotes: 3