Skip to content

Polyfill to fix SVG scaling in IE11 and below using the “padding hack” technique

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

Threespot/fluid-svg-polyfill

Repository files navigation

Fluid SVG Polyfill

npm Build Status Coverage Status

Fix SVG responsive scaling in IE 11 and below using the “padding hack” technique. Inspired by https://gist.github.com/Heydon/369185d08d9ce2426f01863625e95525

More info on “padding hack” technique:

Install

$ yarn add @threespot/fluid-svg-polyfill

Usage

import fluidSVGPolyfill from "@threespot/fluid-svg-polyfill";

// Add “is-fluid” class to any SVGs that are fluid width
const svgs = document.querySelectorAll('.is-fluid');

svgs.forEach( el => fluidSVGPolyfill(el) );

You can also specify a custom class to add to the wrapper <div>:

fluidSVGPolyfill(el, { wrapperClass: "custom-class" });

License

This is free software and may be redistributed under the terms of the MIT license.

About Threespot

Threespot is an independent digital agency hell-bent on helping those, and only those, who are committed to helping others. Find out more at https://www.threespot.com.

Threespot

About

Polyfill to fix SVG scaling in IE11 and below using the “padding hack” technique

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published