1.0.5 • Published 4 years ago
@atyoursite/scss v1.0.5
Polyfills
aysPolyfillObjectFit()
Description
aysPolyfillObjectFit() checks if the browser supports object-fit.
if not, all img elements with parameter data-object-fit="cover" and data-object-fit="contain" will be converted to background versions.
Background image cover and contain are fully supported.
<img src="{{path to image file}}" data-object-fit="contain" alt="{{alternative description}}">
Dependency
Open a terminal window inside the root of your project to install the node package.
npm install --save-dev @atyoursite/polyfill
Usage
To be able to use the function, you will have to import it as a dependency
import { aysPolyfillObjectFit } from '@atyoursite/polyfill';
Initialize
aysPolyfillObjectFit();