Giter Site home page Giter Site logo

rn-lazy's Introduction

rn-lazy : AngularJS lazy image loader directive

The user speed perception is critical for your web application.

This directive lets you show a spinner (image or DOM based) while your images are loading.

Proudly brought to you by the @revolunet team.

Full working demo at : http://tab.demo.revolunet.com

Usage :

  • rn-lazy-background="'http://path/to/image.jpg'": the image is loaded then set as background-image when ready. there is a data-binding here so the image source can be changed dynamically and loader displayed on-demand.
  • rn-lazy-loading-class (optional) : this class should be set initially, it will be removed when image loaded
  • rn-lazy-loaded-class (optional: this class will be set when the image has been loaded
  • rn-lazy-loader (optional) : use the given selector to clone the target DOM and add it to the current element while loading (for DOM+CSS based spinners)

DOM/CSS spinner example :

<div id="loader">loading awesomeness...</div>
<div rn-lazy-background="'http://path/to/big/image1.jpg'" rn-lazy-loader="#loader"></div>
<div rn-lazy-background="'http://path/to/big/image2.jpg'" rn-lazy-loader="#loader"></div>
<div rn-lazy-background="'http://path/to/big/image3.jpg'" rn-lazy-loader="#loader"></div>

Image-based spinner example :

<style>
.loading {
    background: url(data:image/png;base64,iVBORw0KGgoAAA...;) no-repeat center center; 
}
.loaded {
    background-size:cover;
    background-position:center center;
}
</style>
<div class="loading" rn-lazy-background="'http://path/to/big/image.jpg'" rn-lazy-loading-class="loading" rn-lazy-loaded-class="loaded"></div>

Licence

As AngularJS itself, this module is released under the permissive MIT license. Your contributions are always welcome.

rn-lazy's People

Contributors

revolunet 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rn-lazy's Issues

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.