All Projects → greg-md → Ng Lazy Load

greg-md / Ng Lazy Load

Licence: mit
Lazy loading images with Angular.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
js
455 projects
ts
41 projects

Projects that are alternatives of or similar to Ng Lazy Load

Jquery.lazy
A lightweight, fast, feature-rich, powerful and highly configurable delayed content, image and background lazy loading plugin for jQuery & Zepto.
Stars: ✭ 965 (+7941.67%)
Mutual labels:  lazyload, lazy
Pimg
📷 Mini Image Lazy Loader for P(R)eact and Vue
Stars: ✭ 97 (+708.33%)
Mutual labels:  image, lazy
Responsively Lazy
Lazy load responsive images
Stars: ✭ 1,080 (+8900%)
Mutual labels:  lazyload, lazy
Zsh Lazyload
zsh plugin for lazy load commands and speed up start up time of zsh
Stars: ✭ 33 (+175%)
Mutual labels:  lazyload, lazy
jekyll-loading-lazy
🧙🏽‍♀️ Automatically adds loading="lazy" to <img> and <iframe> tags. Load images on your sites lazily without JavaScript.
Stars: ✭ 41 (+241.67%)
Mutual labels:  lazy, lazyload
Ng In Viewport
Allows us to check if an element is within the browsers visual viewport
Stars: ✭ 178 (+1383.33%)
Mutual labels:  lazyload, ng
Lazy Vue
A small lazy image loader for Vue
Stars: ✭ 63 (+425%)
Mutual labels:  image, lazy
Defer.js
🥇 A super small, super efficient library that helps you lazy load everything like images, video, audio, iframe as well as stylesheets, and JavaScript.
Stars: ✭ 138 (+1050%)
Mutual labels:  image, lazyload
lazy-load-images.js
Progressive & lazy loading images.
Stars: ✭ 17 (+41.67%)
Mutual labels:  lazy, lazyload
Lazyload Image
HTMLImageElement extension for lazy loading.
Stars: ✭ 208 (+1633.33%)
Mutual labels:  image, lazyload
Layzr.js
A modern lazy loading library for images.
Stars: ✭ 5,646 (+46950%)
Mutual labels:  image, lazy
Accessible Image Lazy Load
😴 gandul! accessible lazy loading images
Stars: ✭ 281 (+2241.67%)
Mutual labels:  lazyload, lazy
Progressively
A JavaScript library to load images progressively 🌇
Stars: ✭ 691 (+5658.33%)
Mutual labels:  image, lazyload
Eager Image Loader
The eager-loading for image files on the web page that loads the files according to your plan. This differs from the lazy-loading, for example, this can be used to avoid that the user waits for the loading.
Stars: ✭ 22 (+83.33%)
Mutual labels:  image
Mediawiki Lazyload
An extension to delay loading of images on MediaWiki pages.
Stars: ✭ 8 (-33.33%)
Mutual labels:  lazyload
React Image
React.js <img> tag rendering with multiple fallback & loader support
Stars: ✭ 917 (+7541.67%)
Mutual labels:  image
Pdf To Image
Convert a pdf to an image
Stars: ✭ 906 (+7450%)
Mutual labels:  image
Bootstrap Image Hover
Image hover effects that work with or without bootstrap
Stars: ✭ 858 (+7050%)
Mutual labels:  image
Cometa
Super fast, on-demand and on-the-fly, image processing.
Stars: ✭ 8 (-33.33%)
Mutual labels:  image
React Simple Img
🌅 React lazy load images with IntersectionObserver API and Priority Hints
Stars: ✭ 905 (+7441.67%)
Mutual labels:  lazyload

Ng Lazy Load

npm version Build Status

Lazy loading images with Angular.

Table of Contents:

Installation

To install this library, run:

$ npm install @greg-md/ng-lazy-load --save

How It Works

Setting up in a module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

// 1. Import lazy loading module;
import { LazyLoadModule } from '@greg-md/ng-lazy-load';

import { AppComponent } from './app.component';

@NgModule({
  imports: [
    BrowserModule,
    // 2. Register lazy loading module.
    LazyLoadModule,
  ],
  declarations: [
    AppComponent,
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Using in templates

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <img src="loading.jpg" lazy-load="lazy-image.jpg" />
  `,
})
export class AppComponent { }

Directive Attributes

threshold

By default images are loaded when they appear on the screen. If you want images to load earlier, use threshold parameter. Setting threshold to 200 causes image to load 200 pixels before it appears on viewport.

Example:

<img src="loading.jpg" lazy-load="lazy-image.jpg" threshold="200" />

container

You can also use directive for images inside scrolling container, such as div with scrollbar. Just pass the container element.

Example:

<div #container>
    <img src="loading.jpg" lazy-load="lazy-image.jpg" threshold="200" [container]="container" />
</div>

bg-src

Set default image in background and lazy load image directly in the src attribute.

Useful with non-effective image URLs. This will avoid to load lazy image twice.

Example:

<img bg-src="loading.jpg" lazy-load="lazy-image.jpg" width="200" height="200" />

License

MIT © Grigorii Duca

Huuuge Quote

I fear not the man who has practiced 10,000 programming languages once, but I fear the man who has practiced one programming language 10,000 times. #horrorsquad

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].