Monday, February 16th, 2009

xLazyLoader: Lazy loader callback framework

Category: JavaScript, jQuery, Library

Oleg Slobodskoi, guru behind jimdo.com, has open sourced xLazyLoader a jQuery plugin that lets you asynchronously load resources such as JavaScript, CSS, and images. Quite useful if you want to head of and load some CSS to do something custom and you need the callback.

Example

javascript

  1. $.xLazyLoader({
  2.      js: ['ui.core.js','ui.dialog.js'],
  3.      css: ['ui.core.css', 'ui.dialog.css'],
  4.      image: ['your_image.jpg', 'your_image1.jpg', 'your_image2.jpg'],
  5.      name: 'dialog',
  6.      load: function(){
  7.          alert('All files are loaded');
  8.      }
  9.  });

Features

  • load one or multiple files for each type
  • onload callback for javascript, CSS and images
  • prevents double loaded scripts or css files
  • method to remove scripts/css by using group name
  • method to disable/enable css files by using group name, so you can use this plugin like a css switcher
  • Tested in IE6, IE7, FF2/3, Opera 9, Safari 3, Chrome

Posted by Dion Almaer at 6:55 am
Comment here

+++--
3.6 rating from 50 votes

Comments Here »

Comments feed TrackBack URI

Leave a comment

You must be logged in to post a comment.