Skip to content

andrezimpel/jquery-srcset

Repository files navigation

jquery.srcset

use srcset in each and every browser today. display responsive and hi-res images.

do it

bower install jquery.srcset

quick start

Three quick start options are available:

info

jquery-srcset behaves like srcset should. it extends the functionality (width and density combined) of Safari on Mac and iOS. last but not least it add's support to older browsers, like that one a company recently killed. if you want to know more about srcset hit this link and read a nice article by smashing magazine.

usage

simple usage

just include the following scripts:

<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="/path/to/bower_components/jquery-srcset/jquery.srcset.js"></script>
<script src="... others"></script>

the image tag should look like this:

<img src="/path/to/image.jpg"
     srcset="/path/to/image-mobile.jpg 320w 1x,
             /path/to/image-mobile@2x.jpg 320w 2x">

then run:

$('[srcset]').srcset();

that's it.

options

the following options are available

$('[srcset]').srcset({
  // check if the image is available
  ajax: true // default: true
});

creator

andre zimpel

hit me up if you want to join!

copyright and license

code and documentation copyright 2011-2014 andre zimpel. code released under the MIT license.

About

use srcset in each and every browser today. display responsive and hi-res images.

Resources

License

Stars

Watchers

Forks

Packages

No packages published