Home

Awesome

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 :

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.