GithubHelp home page GithubHelp logo

lynzz / jquery_lazyload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tuupola/lazyload

0.0 2.0 0.0 4.86 MB

jQuery plugin for lazy loading images

Home Page: http://www.appelsiini.net/projects/lazyload

jquery_lazyload's Introduction

Lazy Load Plugin for jQuery

Lazy Load delays loading of images in long web pages. Images outside of viewport wont be loaded before user scrolls to them. This is opposite of image preloading.

Using Lazy Load on long web pages containing many large images makes the page load faster. Browser will be in ready state after loading visible images. In some cases it can also help to reduce server load.

Lazy Load is inspired by YUI ImageLoader Utility by Matt Mlinac.

How to Use?

Lazy Load depends on jQuery. Include them both in end of your HTML code:

<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.lazyload.js" type="text/javascript"></script>

You must alter your HTML code. Put the place holder image into src attribute. Demo pages use 1×1 pixel grey gif. URL of the real image must be put into data-original attribute. It is good idea to give Lazy Loaded image a specific class. This way you can easily control which images plugin is binded to. Note that you should have width and height attributes in your image tag.

<img class="lazy" src="img/grey.gif" data-original="img/example.jpg"  width="640" heigh="480">

then in your code do:

$("img.lazy").lazyload();

This causes all images of class lazy to be lazy loaded.

More information on Lazy Load project page.

License

All code licensed under the MIT License. All images licensed under Creative Commons Attribution 3.0 Unported License. In other words you are basically free to do whatever you want. Just don’t remove my name from the source.

Changelog

1.8.4

1.8.3

  • Proper fix for #48. If image did not have width and height set Webkit browsers needed initial scroll for images to display. (@sc-aboudreau)

1.8.2

  • Workaround for bug #30 IOS5 Safari did not load images when navigating with back button.

1.8.1

  • Fix bug #48. In some cases initial scroll was needed for images to load. (Nick George)
  • Fix bug #42. Reset internal failure counter when image is found. Makes counter logic more intuitive. (Josep del Rio)
  • Fix bug #52. Fix :in-viewport convenience method. (Jonathan Palardy)

1.8.0

  • Allow different elements to use different containers. (Rob Walch)

1.7.1

  • Fix bug #18. Document was always scrolled to top issue on IE 7 and Chrome 17 if using jQuery 1.6 or older. (Ross Allen)
  • General code speedup (Valentin Zwick)

1.7.0

  • Optimized viewport selectors. Around 25% speed increase compared to 1.6.0.
  • Add data_attribute parameter. Allows custom naming of original data attribute. (Bryan Chow)
  • Track window resize event. (Simon Baynes)
  • Add appear event. This function is called when image appears to viewport but before it is loaded.
  • Add load event. This function is called when image is loaded. (Nick Larson)
  • Renamed effectspeed parameter to effect_speed. Old version will still works couple of versions. This parameter was previously undocumented.
  • Fix failure_limit bug #19. (Brandon)

1.6.0

  • Rename original attribute to data-original to be HTML5 friendly.
  • Remove all code regarding placeholder and automatically removing src attribute. It does not work with modern browsers. Must use data-original attribute instead.
  • Add support for James Padolseys scrollstop event. Use when you have hundreds of images.
  • Add skip_invisible parameter. When true plugin will skip invisible images. (Valentin Zwick)
  • Renamed failurelimit parameter to failure_limit. Old version will still work couple of versions.

1.5.0

  • Support for removing the src attribute already in HTML. This is not a drop in solution but gives additional speed for those who need it. (Jeremy Pollock)

1.4.0

  • When scrolling down quickly do not load the images above the top. (Bart Bruil)

1.3.2

  • Support for scrolling within a container.
  • Fixed IE not loading images.

jquery_lazyload's People

Contributors

baynezy avatar bryanchow avatar ifightcrime avatar izzmo avatar joseprio avatar jpalardy avatar robwalch avatar silentmatt avatar tuupola avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.