Giter Club home page Giter Club logo

ember-img-loading's Introduction

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/[email protected] 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.

ember-img-loading's People

Contributors

dependabot[bot] avatar ember-tomster avatar sinankeskin avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.