Skip to content

Ember CLI addon that allows you to gracefully handle image loading.

License

Notifications You must be signed in to change notification settings

bmfay/ember-lazy-image

 
 

Repository files navigation

ember-lazy-image

Build Status

ember-lazy-image is a component that allows you to gracefully handle image loading.

Component will load images lazily, only if they appeared in the view port. This optimization brings page load time down.

Default loading placeholder is stolen from aurer and his awesome codepen.

Usage

npm install ember-lazy-image --save

lazy-image

{{lazy-image url='http://my-valid-url.com/foo.jpg'}}

Component will wait until the image is loaded and while waiting it will show default loading placeholder (seee above).

You can customize loading placeholder by passing it as an parameter:

{{#lazy-image url='http://my-valid-url.com/foo.jpg'}}
  <!-- custom template goes here, spinner, svg, etc. -->
{{/lazy-image}}

You can also define the fallback if the image failed to load. By default, component will render Image failed to load text.

You can customize error text by passing it as an parameter:

{{lazy-image url='http://my-not-valid-url.com/foo.jpg' errorText='Something went wrong.'}}

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

About

Ember CLI addon that allows you to gracefully handle image loading.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%