Skip to content

Latest commit

 

History

History
22 lines (13 loc) · 630 Bytes

README.md

File metadata and controls

22 lines (13 loc) · 630 Bytes

ratiospy.js

Compare ratios of DOM elements – easily shim the object-fit property on older browsers.

Check out demo

How does it work?

Run the script to compare a DOM element – the frame - and a descendant – the child. The child receives a class: either ratio-portrait or ratio-landscape.

On applying little CSS, you can use these two classes to do most of the magic of object-fit.

Browser support

  • TBD
  • current CSS fails on Opera Mini due to using transform

See also

  • Element queries