/**
*    @Author: Arash Karimzadeh
*    @Email:
*    @Desciption: Here, I post some of my recent
*    researches. Also you can see my code projects.
*/  
Ajax C # Chrome CMS dateNet Design Patterns includeMany JavaScript jBind Joomla jQuery Plugin rails ror RubyOnRails SQLite xul

+ All tags

Content View Hits : 345056
Bookmark and Share
Chainclude (jQuery pluign for including js and css in a sequence) PDF Print
Written by Arash Karimzadeh   
Sunday, 15 March 2009 12:03

Include JS and CSS in a sequence. This plugin let you to include files as chain and is now merged with $.includeMany which you can find out more about it by reading this article or just reading the chainclude functionality in this article. IncludeMany plugin version 1.2.0 and upper now support this functionality.

The syntax is easy:
$.chainclude(files,[finalCallback]);

Download includeMany (+chainclude)

You can get it here or check this article for the latest version.

Chainclude (include css and js sequentially)

Parameters

  • files

Can be
  1. List of files such as ['fileurl1','fileurl2',...,'fileurln']
  2. Key/value object of files such as {'fileurl1':callback,'fileurl2':callback,...,'fileurl2':callback}
  • finalCallback [function] optional

Is a function which will be called after all files are loaded and all callbacks have been called

Examples

  • The simplest format is:
    
                      
    1. $.chainclude( ['js1.js','scripts/js2.js'] ,someOptionalFunction);
    
                      
     
    
                      
                    
    You can avoid someOptionalFunction.
  • You can define a callback for each file
    
                      
    1. $.chainclude(
    2. {
    3. 'script1.js':function(){ /*something*/ },
    4. 'script2.js':function(){ /*something*/ }
    5. }
    6. );
    
                      
     
    
                      
                    

 

Sample File

You can download the sample file here.

Tags: includeMany | jQuery

Last Updated on Sunday, 26 September 2010 10:54