npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-pretty-load

v0.0.7

Published

Angular Pretty Load directive ============

Downloads

310

Readme

Angular Pretty Load directive

Load your images in style using Angular: add an overlay before and during the image load, with the exact same position and dimensions of the image.

| Without Angular Pretty Load | With Angular Pretty Load | | ------------------------------ | --------------------------- | | | |

Usage

Installation

Just use Bower.

bower install angular-pretty-load --save

Then, inject it into your application:

angular.module('MyApp', ['platanus.prettyLoad']);

Directive in html template

In order to use the most basic mode, you should specify both the width and height of the image in your CSS

<img pretty-load ng-src="http://your.image.jpg">

Unknown image size

If one or both dimensions are not specified in your CSS, but the API you're consuming or the server behind can provide the original size use this:

<img ng-src="{{image.src}}"
  pretty-load
  pretty-load-width="{{image.width}}"
  pretty-load-height="{{image.height}}">

The directive will not override properties given to the image (width: 100%), but it will complete both width and height based on the original image ratio.

Overlay Color

You can set a common overlay color for all images:

.pretty-load-overlay {
  background-color: #333;
}

or customize it for every image:

<img ng-src="{{image.src}}"
  pretty-load
  pretty-load-width="{{image.width}}"
  pretty-load-height="{{image.height}}"
  pretty-load-color="{{image.color}}">

Overlay Animation

You have total control on how to handle the CSS transition from the overlay to the final image.

This CSS will give you the same results as the demo:

.pretty-load-overlay {
  opacity: 0;
}

.pretty-load-loading .pretty-load-overlay {
  opacity: 1;
  transition: opacity 0.5s ease;
}

.pretty-load-completed .pretty-load-overlay {
  opacity: 0;
  transition: opacity 1.7s ease;
}

CSS Classes

The directive wraps the image inside a div element. This container will have the following classes applied according to the state of the image inside:

  • .pretty-load-init: added when the directive is initialized
  • .pretty-load-loading: added when the directive is initialized and removed when the image finishes loading
  • .pretty-load-completed: added when the image finishes loading

These are used in our example CSS and you can use them to control additional (for example, a spinner icon) or create more complex transitions between these states.

  • Note: angular-pretty-load does not handle lazy loading. You would have to use an additional library for that.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Credits

Thank you contributors!

angular-pretty-load is maintained by platanus.

License

© 2015 Platanus, SpA. It is free software and may be redistributed under the terms specified in the LICENSE file.