Socket
Book a DemoInstallSign in
Socket

ember-img-loading

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-img-loading

The default blueprint for ember-cli addons.

2.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ember-img-loading

This is an element modifier for images. If the browser supports natively, it adds loading attribute to img tag, if the browser doesn't support, it fallbacks and loads to lazysizes library and adds some data- attributes.

Compatibility

  • Ember.js v3.28 or above
  • Embroider or ember-auto-import v2

Installation

ember install ember-img-loading

Usage

Simply add modifier to img tag like;

<img
  {{loading
    type='lazy'
    src='/images/slide.png'
    srcset='/assets/images/slides/slide.png 1x, /assets/images/slides/slide@2x.png 2x'
    sizes='auto'
  }}
/>
  • type parameter can be: "auto", "lazy" or "eager". If not present auto is the browser default.
  • You can use src and srcset parameters together but you should set at least one.
  • sizes parameter can be only "auto" and it works only lazysizes library which means your browser doesn't support native lazy loading.
  • If you want to reach the browser lazy loading support this modifier adds img_loading parameter to window object.
  • So you can reach with window.img_loading. Either "native" or "lazysizes" will return.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

ember-addon

FAQs

Package last updated on 23 Apr 2023

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.