0.0.3 • Published 7 years ago
object-fit-picture-tag-polyfill v0.0.3
Object Fit Picture Tag Polyfill
Cross browser CSS object-fit support for picture tags
- Fast and lightweight
- No framework dependencies
- Works with both
<picture>
and<img>
tags
Installation
However you like:
<script src="dist/object-fit-picture-tag-polyfill.min.js"></script>
npm install --save object-fit-picture-tag-polyfill
Usage
Append your
<picture>
tags with eitherdata-object-fit-cover
ordata-object-fit-contain
Import the plugin
import objectFitPolyfill from 'object-fit-picture-tag-polyfill';
- Instantiate the class and pass it any options
new objectFitPolyfill({ fitPosition: 'center center' });
(optional) if you want to reinitialise the script you can call the
init()
method directly (after the class has been initialised)let polyfill = new objectFitPolyfill(); polyfill.init();
Parameters
(fitPosition, addContainer)
MIT © Chris Boakes