Get new jQuery plugins just once a week
November 20, 2012
Responsive-Img | jQuery plugin to create responsive images
Responsive-Img is a jQuery plugin that swaps out an image’s src attribute based on its container’s width when the DOM is ready and when the browser is resized.Using a PHP file, Responsive Img creates new images on the fly the first time they’re needed and puts them on your server.
Therefore, you can add Responsive-Img to any site, without creating new images.
This jQuery plugin has the following options :-
- Breakpoints are key/value pairs of filename suffixes and width breakpoints in pixels.Pairs should be wrapped in brackets and separated by commas (leave off the last comma).
- srcAttribute is a string for the attribute that holds the image’s source.
- This defaults to src, but should be overridden if the src attribute holds a placeholder image.
- pathToPHP is a string for the path from the file that calls Responsive Img to the PHP file that creates new images.This value is js by default.
- createNewImages is a boolean that lets you override the default option to create different sized images on the fly.
Created by Drew Thomas
Make your existing images responsive without creating new images.
Sign up for our weekly newsletter.