Mootools periodical funcion and time rewind

Posted by hsz on Stack Overflow See other posts from Stack Overflow or by hsz
Published on 2010-06-07T11:00:21Z Indexed on 2010/06/07 11:22 UTC
Read the original article Hit count: 207

Filed under:
|
|

Hello !

I have some function taht is caller periodically:

var func = function() {
    alert('Hello world!');
};
func.periodical(5000);

This function is also called with click event:

$('element').addEvent('click', function(){
    func();
});

The timer starts and counts 2500msec, then I click $('element'), func() is executed and I want right now to reset the timer that func() will not be called in next 2500msec but in following 5000msec.

How to do that ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about mootools