My favorites | Sign in
Logo
                
Search
for
Updated May 29, 2009 by oleg008
xLazyLoader  
Lightweight js, css and images loader

Description

This is a small (6 Kb uncompressed) asynchron loader for javascripts, css and images. I have designed this plugin to lazyload a whole UI extension with javascript, images, css files and get a callback when all files are loaded.

I am very glad, that jQuery decided to add this functions to jQuery core (Version 1.4) :)

http://docs.jquery.com/JQuery_1.4_Roadmap

Demo

http://www.ajaxsoft.de/projects/xlazyloader/

Features

Dependences

- jquery-1.3.2

Usage

Example 1:

Load some files

$.xLazyLoader({
    js: 'jquery.ui.all.js',
    css: 'ui.allplugins.css',
    img: 'your_image.jpg',
    success: function(){
        alert('All files are loaded');
    }
});

Example 2:

Load multiple files of each type

$.xLazyLoader({
    js: ['ui.core.js','ui.dialog.js'],
    css: ['ui.core.css', 'ui.dialog.css'],
    img: ['your_image.jpg', 'your_image1.jpg', 'your_image2.jpg'],
    name: 'dialog',
    success: function(){
        alert('All files are loaded');
    },
    error: function(){
        alert('Some files were not loaded');
    },
    each: function(url){
        alert('This file was loaded '+url);
    }

});

Example 3:

Remove tags from head (javascript is still working, but css is completely destroyed )

$.xLazyLoader('destroy','dialog');

Example 4:

Disable css.

$.xLazyLoader('disable','dialog');

Enable css.

$.xLazyLoader('enable','dialog');

Hosted by Google Code