Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9
AngularJS Module to make images appear with transition as they load.
License
ArunMichaelDsouza/ng-image-appear
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
AngularJS Module to make images appear with transition as they load.
Wraps the
imgtag within a wrapper and adds a gif loader in between. No more ugly-looking progressively loading images!
http://arunmichaeldsouza.github.io/ng-image-appear/
This project has also been ported to ReactJS -react-image-appear.
Use ng-image-appear directly from jsdelivr CDN
https://cdn.jsdelivr.net/npm/ng-image-appear@1.11.15/dist/ng-image-appear.min.js
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 includeng-image-appear.min.js to your project.
AddngImageAppear as a dependency in your angular app module.
Include the directive with animg tag in your HTML file with any of the availableoptions.
Include thesrc and theng-image-appear directive as anattribute.
Example -
varmyApp=angular.module('myApp',['ngImageAppear']);myApp.controller('appCtrl',['$scope',function($scope){}]);
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearresponsivetransition-duration="1s"animation="fillIn"animation-duration="1s"easing="ease-out"/>
This parameter specifies the transition duration for the image to appear. Default value is700ms.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appeartransition-duration="4s"/>
Adds a background color to the image wrapper element.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearbg-color="#50a4e2"/>
If this option is specified, then no gif loader is shown in the image wrapper element.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearno-loader/>
Use this option to make the image wrapper responsive. In that case the width of the wrapper is calculated in%, otherwise it is calculated inpx.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearresponsive/>
Adds a default placeholder in the image wrapper background.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearplaceholder/>
You can override the default placeholder background and add your own by passing an image link to this option.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearplaceholder="http://getuikit.com/docs/images/placeholder_600x400.svg"/>
Use this option to add a CSS class to the placeholder background.
Example -
<style>.placeholder-css {background-size: contain;}</style><imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearplaceholderplaceholder-class="placeholder-css"/>
Add CSS styles to the placeholder background using this option.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearplaceholderplaceholder-style="background-size: contain;"/>
Add a customgif loader in the image wrapper. Defaultwidth andheight of the loader is40px. The image must be agif.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearloader-img="https://cache.dominos.com/nolo/ca/en/010048/assets/build/images/img/spinner.gif"/>
Use this option to add a CSS class to the loader element.
Example -
<style>.loader-css {width:60px;height:60px;left:calc((100%-60px)/2);top:calc((100%-60px)/2);}</style><imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearloader-class="loader-css"/>
Add CSS styles to the loader element using this option.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearloader-styles="width: 60px; height: 60px; left: calc((100% - 60px) / 2); top: calc((100% - 60px) / 2);"/>
Add a CSS3 powered animation to the image as it appears. Default animation isfadeIn.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearanimation="bounceIn"/>
ng-image-appear has the following built-in CSS3 animations -
This parameter specifies the animation duration for the image to appear. Default value is700ms.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearanimation="fillIn"animation-duration="2s"/>
Specifies the timing-function for the CSS3 powered transition/animation. Default value isease-in-out.
Example -
<imgsrc="https://newevolutiondesigns.com/images/freebies/tropical-beach-background-8.jpg"ng-image-appearanimation="bounceIn"easing="ease-out"/>
Arun Michael Dsouza | Travis Vignon | Lukas Drgon |
|---|
If you'd like to help support the development of the project, please consider backing me on Patreon -
MIT Licensed
Copyright (c) 2016 Arun Michael Dsouza (amdsouza92@gmail.com)
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.
About
AngularJS Module to make images appear with transition as they load.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.








