Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
/lazyloadPublic archive

💀 An ancient tiny JS and CSS loader from the days before everyone had written one. Unmaintained.

License

NotificationsYou must be signed in to change notification settings

rgrove/lazyload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: LazyLoad is no longer being maintained. I'm not responding to issues or pull requests, since I don't use this project anymore and don't have time to work on it. Please feel free to fork it if you want to continue development on it.

LazyLoad is a tiny (only 966 bytes minified and gzipped), dependency-freeJavaScript utility that makes it super easy to load external JavaScript and CSSfiles on demand.

Whenever possible, LazyLoad will automatically load resources in parallel whileensuring execution order when you specify an array of URLs to load. In browsersthat don't preserve the execution order of asynchronously-loaded scripts,LazyLoad will safely load the scripts sequentially.

Use LazyLoad when you need a small, fast, safe dynamic JS or CSS loader, butdon't need the overhead of dependency management or other extra functionalitythat larger script loaders provide.

Downloads

Usage

Using LazyLoad is simple. Just call the appropriate method --css() to loadCSS,js() to load JavaScript -- and pass in a URL or array of URLs to load.You can also provide a callback function if you'd like to be notified when theresources have finished loading, as well as an argument to pass to the callbackand a context in which to execute the callback.

// Load a single JavaScript file and execute a callback when it finishes.LazyLoad.js('http://example.com/foo.js',function(){alert('foo.js has been loaded');});// Load multiple JS files and execute a callback when they've all finished.LazyLoad.js(['foo.js','bar.js','baz.js'],function(){alert('all files have been loaded');});// Load a CSS file and pass an argument to the callback function.LazyLoad.css('foo.css',function(arg){alert(arg);},'foo.css has been loaded');// Load a CSS file and execute the callback in a different scope.LazyLoad.css('foo.css',function(){alert(this.foo);// displays 'bar'},null,{foo:'bar'});

Supported Browsers

  • Firefox 2+
  • Google Chrome
  • Internet Explorer 6+
  • Opera 9+
  • Safari 3+
  • Mobile Safari
  • Android

Other browsers may work, but haven't been tested. It's a safe bet that anythingbased on a recent version of Gecko or WebKit will probably work.

Caveats

All browsers support parallel loading of CSS. However, only Firefox and Operacurrently support parallel script loading while preserving execution order. Toensure that scripts are always executed in the correct order, LazyLoad will loadall scripts sequentially in browsers other than Firefox and Opera. Hopefullyother browsers will improve their parallel script loading behavior soon.

License

Copyright (c) 2011 Ryan Grove (ryan@wonko.com).All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy ofthis software and associated documentation files (the 'Software'), to deal inthe Software without restriction, including without limitation the rights touse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,subject to the following conditions:

The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESSFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS ORCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHERIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

💀 An ancient tiny JS and CSS loader from the days before everyone had written one. Unmaintained.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp