Friday 15 October 2010

Delaying Javascript

I found this routine as it was what I needed and it works perfectly.

var onFooEndFunc = function() {
        var delay = 50; /* milliseconds - vary as desired */
        var executionTimer;
     
        return function() {
                if (executionTimer) {
                        clearTimeout(executionTimer);
                }
     
                executionTimer = setTimeout(function() {
                        // YOUR CODE HERE
                }, delay);
        };
}();

I hope you all find this useful too.

Don't forget the title tag

I just hate visiting a website for the browser to display the title as "NEW PAGE". Yucky frontpage does that.

So simply add the following between the <head> and </head> tags of your document:

<title>Whatever You Want Your Site To Be Called</title>