A Responsive Images approach like Picturefill but managing a picture on background-image css attribute.
npm install picturefill-backgroundNote: Picturefill-background works best in browsers that support CSS3 media queries..
Mark up your responsive images like this.
``html`
`js`
w.picturefillBackgroundOptions = {
selector: "picturefill-background",
backgroundSize: "cover",
backgroundRepeat: "no-repeat",
backgroundPosition: "50% 50%"
};
Redefine this value to replace some of the options
`js`
picturefillBackgroundOptions.selector = "custom-selector";
Notes on the markup above...
* The div[class="picturefill-background"] element is used to apply background-image attribute.div[class="picturefill-background"]
* The element can contain any number of div[data-source] elements.div[data-src]
* Each element must have a data-src attribute specifying the image path.div[data-src]
* Each element can have an optional [data-media] attribute to make it apply in specific media settings. Both media types and queries can be used, like a native media attribute, but support for media _queries_ depends on the browser (unsupported browsers fail silently).data-media
* The matchMedia polyfill is required to support the attribute in older browsers (e.g. IE9, Android 2.3 Browser). See http://caniuse.com/#feat=matchmedia for a table detailing native support for the matchMedia` API.