Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular2-imagelazyload-directive

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-imagelazyload-directive

Angular 2 Image Lazy Load Directive

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

angular2-imagelazyload-directive

npm version

forthebadge

Install

npm i angular2-imagelazyload-directive --save

Import the directive to your project and use it in your images specifing a data-src, width and height

import { ImageLazyLoadDirective } from 'angular2-imagelazyload-directive';

@Component({
  selector: 'my-app',
  template : `
  <img height="200" width="200" imagelazyload threshold="300" ></img>`,
  directives : [  ImageLazyLoadDirective ]
} )
class MyFirstComponent implements OnInit {
  constructor(){}
  ngOnInit(){}
}

By default the directive has a 300px threshold, meaning the image will be loaded 300px before it became visible in the viewport. You can change that by passing a threshold attribute to your img tag.

Also by default the images are fading-in in a duration of 1000ms, you can disable that with the fadeIn attribute or specify the duration using the fadeInDuration (default 1000ms)

Contribute

Any pull-request is more than welcome :boom: :smile:

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code.

License

MIT

Keywords

FAQs

Package last updated on 05 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc