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
- $.lazy([{
- src: 'jquery.elastic.js',
- name: 'elastic'
- }]);
- // And then you use you plugins as you always do
- $('textarea').elastic();
How to work with dependencies
- $.lazy([{
- src: 'ui.draggable.js',
- name: 'draggable',
- dependencies: {
- js: ['ui.core.js'],
- css: ['ui.draggable.css']
- }
- }]);
- // And then you use you plugins as you always do
- $("#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
- $.lazy([{
- src: 'ui.draggable.js',
- name: 'draggable',
- dependencies: {
- js: ['ui.core.js'],
- css: ['ui.draggable.css']
- },
- cache: true
- }]);
Caching is disabled by default, but you can enable it by setting the variable cache to true.
| Version | Changes |
|---|---|
| 1.5 | Refactored. (Thanks Kristofer Karlsson) |
| 1.3.1 | Critical bug fix for argument leakage. |
| 1.3 | Faster, better and stronger. Added cache control and a new API |
| 1.2.2 | Fixed a bug where Lazy would load the same plugin more than once. |
| 1.2 | Added support for jquery’s chainability |
| 1.1 | Added support for css and javascript dependencies |
3 days ago
Wow! I don’t even remember anymore how I managed before this new awesome boilerstrap. http://t.co/bWzwqVf2
3 days ago
If you like coding and competing and want to see Stockholm at its best; Checkout Escape from /dev/null – DICE edition. http://t.co/0SapzZxz
4 days ago
Last night @soe, @tussetor and I won #sthlmstartuphack and the best trophy ever. http://t.co/CJ15cNml
4 days ago
Thanks @kalasjocke, @martinaelm, @javve for a super fun event. Thanks @soe, @tussetor for being awesome teammates. #sthlmstartuphack
5 days ago
Going where none has gone before and pushing the boundaries of what has been called done. Mine, @soe, @tussetor #SthlmStartupHack app ≈Done
6 days ago
Selected map, data and chart tools. http://t.co/I7l6qq4O (via @VirUZI) So much joy in one single place!
7 days ago
How can Comic Sans make people buy your app? http://t.co/KYLGeIW2