Giter Club home page Giter Club logo

jquery-imageloader's Introduction

jQuery.imageloader()

jQuery.imageloader() lets you have granular controls of image loading timing.

DEMO

beatak.github.com/jquery-imageloader/

EXAMPLE

$('.YOUR-SELECTOR').imageloader(OPTIONS)

OPTIONS

The instance option as follows:

Name Type Default Description
selector string (empty string) Selector for the elements that $.fn.imageloader() will look for in order to load the image. If the empty string is passed, $.fn.imageloader() will try to load the image on "this" object.
dataattr string "src" Data attribute for the elements that $.fn.imageloader() will look for. As default, $.fn.imageloader() will look for data-src attribute.
background boolean false true if you want to load image as background-image css.
each function null Callback function for each image is loaded. when you try to load one image, it doesn't make any difference from callback. See Demo
callback function null Callback function when the image is loaded. "this" is passed as the first argument. See Demo
timeout number 5000 Millisecond for loading timeout.

There is also a global option:

Name Type Default Description
$.imageloader.queueInterval number 17 A browser can only issue parallel HTTP requests 2 to 9 for each domain name as a default (according to Browserscope, May 2012). When you try to load massive numbers of images all at once, it can consume all browser's UI thread. So $.fn.imageloader() is using a time-domain queue for controling loading timing. 17 millisecond is a one frame delay under 60fps. As default, when you apply $.fn.imageloader() to numbers of elements, it will make <img> elements every 17 milliseconds.

CREDIT

© 2012 Takashi Mizohata.

Licensed under MIT.

Special thanks to Meetup

jquery-imageloader's People

Contributors

beatak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jquery-imageloader's Issues

if you run multiple imageloader() on one image, the result may not be constant.

let's say, there's a image gallery application. There's one big picture, and there are thumbnails. When you click on each thumbnail, the big picture changes.

In a simple implementation, there's a handler attached to the click event, that triggers imageloader() on the big picture. it works most of the case.

But If you keep clicking the thumbnails before the big picture gets loaded, and if the server returns not sequentially, the eventual result may not be the way you expect. It'd be nice, if there's a way to control the result.

Issue with different dataattr

When using a different dataattr, the script won't work.

Fix is on line 115:
var src = $elm.data('src');
needs to be changed to:
var src = $elm.data(attr);

Image Loading Fails sometimes - DOM elem deleted

Jquery ImageLoader fails one in 100 times for me. When the page loads, it does not give any error and deletes the image dom element. On reloading, it gives me the correct image though. Is there a way the error can be fixed or handled? Thanks

Load on scroll

Your plugin works like a charm.

The only feature I'm missing is the possibility to tell it to load images when they appears on the page, instead of loading all images continuously from DOM loading.

I tried to attach imageloader() to each image but the plugins bugged, apparently because all images were not set at the same time. Seems like it tried to create a queue for each imageloader()...

Do you have a proper way to do that ?

Thanks

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.