Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Generate img tags based on viewport width
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
js
README

README

ImgReplacer - ver 0.1
This is a really simple and lightweight jQuery Plug in used to generate img tags based on the browser's viewport width - NOT the devices width.
There are currently only 3 stages for img tag generation. You must provide 3 images based on width, this plug in does NOT generate images, it just selects the appropriate image based on the width of the browser window. Thus it's good for responsive websites.

This is just an entry version, I might introduce more options etc.

Installation:
HTML - 
<div class="imgreplace" data-480="/img/img-480.jpg" data-767="/img/img-767.jpg" data-fallback="/img/img-767.jpg"></div>

Script -
$('div.imgreplace').imgreplacer();

The script will completely remove the div and replace it with an img tag that has the same class name as the div and the corresponding image source.


created by Ilias Iovis
This plug in was developed for https://github.com/prestarocket so credits go to him for the idea.
http://www.iliasiovis.com @iliasiovis info@iliasiovis.com
Something went wrong with that request. Please try again.