AngularJS Module to make images appear with transition as they load.
imgtag within a wrapper and adds a gif loader in between. No more ugly-looking progressively loading images!
This project has also been ported to ReactJS - react-image-appear.
Use ng-image-appear directly from jsdelivr CDN
You can install the package using bower. Make sure you have bower installed, then run :
bower install ng-image-appear
npm install ng-image-appear
Or, download the latest version and include
ng-image-appear.min.js to your project.
ngImageAppear as a dependency in your angular app module.
Include the directive with an
img tag in your HTML file with any of the available options.
src and the
ng-image-appear directive as an
var myApp = angular;myApp;
This parameter specifies the transition duration for the image to appear. Default value is
Adds a background color to the image wrapper element.
If this option is specified, then no gif loader is shown in the image wrapper element.
Use this option to make the image wrapper responsive. In that case the width of the wrapper is calculated in
%, otherwise it is calculated in
Adds a default placeholder in the image wrapper background.
You can override the default placeholder background and add your own by passing an image link to this option.
Use this option to add a CSS class to the placeholder background.
Add CSS styles to the placeholder background using this option.
Add a custom
gif loader in the image wrapper. Default
height of the loader is
40px. The image must be a
Use this option to add a CSS class to the loader element.
Add CSS styles to the loader element using this option.
Add a CSS3 powered animation to the image as it appears. Default animation is
ng-image-appear has the following built-in CSS3 animations -
This parameter specifies the animation duration for the image to appear. Default value is
Specifies the timing-function for the CSS3 powered transition/animation. Default value is
Arun Michael Dsouza
Copyright (c) 2016 Arun Michael Dsouza (firstname.lastname@example.org)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 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 all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.