Skip to content

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

License

Notifications You must be signed in to change notification settings

Stolzenhain/ratiospy.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published