Saturday, August 21, 2010

Canvas Loading Image Replacement Plugin

I know I mentioned this before, but I've recently released a simple jQuery plugin that replaces the standard ajax loading images with a canvas version that works in places where animated GIFs do not (read: Android WebKit).  Well, after posting about it in a certain Google Group to do with Mobile Web Development I received a lot of feedback, mainly that JQuery is a hefty requirement for a mobile website, so I re-wrote it without JQuery. The results can be found here:

Here's how it works:

 window.onload = function() {
  var img = document.getElementById("imgLoader");
  var span = document.getElementById("spanLoader");
  canvasLoaderReplace(img, {color:'red'});
  canvasLoaderReplace(span, {backgroundColor:'red', radius:'40'});

  • Before

  • After


No comments:

Post a Comment