Lazy

This Jquery plugin is an on-demand Jquery plugin loader, also known as a lazy loader. Instead of downloading all Jquery-plugins, you might or might not need, when the page loads. Lazy downloads the plugins when you actually use them.

Lazy is very lightweight, super fast, and smart. Lazy will keep track of all your plugins and dependencies and make sure that they are only downloaded once.

How to use Lazy

  1. $.lazy([{
  2.  src: 'jquery.elastic.js',
  3.  name: 'elastic'
  4. }]);
  5.  
  6. // And then you use you plugins as you always do
  7. $('textarea').elastic();

How to work with dependencies

  1. $.lazy([{
  2.  src: 'ui.draggable.js',
  3.  name: 'draggable',
  4.  dependencies: {
  5.   js: ['ui.core.js'],
  6.   css: ['ui.draggable.css']
  7.  }
  8. }]);
  9.  
  10. // And then you use you plugins as you always do
  11. $("#draggable").draggable();

This will load ui.draggable.css and ui.core.js before it loads ui.draggable.js and applies it on the element draggable.

Enable or disable caching

  1. $.lazy([{
  2.  src: 'ui.draggable.js',
  3.  name: 'draggable',
  4.  dependencies: {
  5.   js: ['ui.core.js'],
  6.   css: ['ui.draggable.css']
  7.  },
  8.  cache: true
  9. }]);

Caching is disabled by default, but you can enable it by setting the variable cache to true.

Release notes
VersionChanges
1.5Refactored. (Thanks Kristofer Karlsson)
1.3.1Critical bug fix for argument leakage.
1.3Faster, better and stronger. Added cache control and a new API
1.2.2Fixed a bug where Lazy would load the same plugin more than once.
1.2Added support for jquery’s chainability
1.1Added support for css and javascript dependencies

556 days ago

Read one article about glass; read this one about Corning, Corning’s Gorilla Glass, Apple and the future. http://t.co/xakeeQzU (via @VirUZI)

558 days ago

I just bought CHTEMELE; a boardgame about HTML5 for 2 – 5 players. http://t.co/kbpQLivu

560 days ago

A normal male ejaculation is equivalent of 16 terabyte of information. http://t.co/tkLndAwg

562 days ago

We are 18, we have no work, we don’t study, we are Anonymous. -We know. http://t.co/NHPa7gjR

562 days ago

We are 18, we have no work, we don’t study, we are Anonymous. -We know. http://t.co/NHPa7gjR

563 days ago

Anonymous plan to DDoS the Central Bank of Sweden’s website, in the middle of the Swedish night, to hurt our economy. Have fun, Goodnight :)

563 days ago

Book trailer for Instant: The story of Polaroid [the Apple of the 60s]. http://t.co/y4srSGmP