Home

Awesome

<x-imager>

A Polymer element for responsive images with Imager.js

Maintained by Addy Osmani.

Demo

Check it live.

Installation

Install using Bower:

 bower install x-imager

Usage

  1. Import Web Components' polyfill (platform.js)

    <script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.1.4/platform.js"></script>
    
  2. Import Custom Element:

    <link rel="import" href="x-imager.html">
    
  3. Start using it!

    <x-imager></x-imager>
    

Options

AttributeOptionsDefaultDescription
srcstring``URL endpoint for images
widthsspace separated list``available image widths
widthnumber``enforced size of the image placeholder
selectorstringdelayed-image-loadused to locate your div placeholders
classstring``Class name to give your resizable images
resizebooleantrueupdate the src attribute of the relevant images
lazyloadbooleanfalseToggle the lazy load functionality
scrollDelaynumber``helps performance by setting a higher delay

Examples:

<x-imager widths="200 260 320 600" src="http://placehold.it/{width}" width="340"></x-imager>
<x-imager widths="400 460 420 1200" src="http://placehold.it/{width}" width="500" class="img-replace" resize="false" className="imagered"></x-imager>
<x-imager widths="400 460 420 1200" src="http://placehold.it/{width}" width="400" class="img-replace" resize="false" className="imagered" scrollDelay="100" lazyload="true"></x-imager>

License

MIT License