Skip to content

samuelpetersson/dom-aspect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dom-aspect

Maintain element ratio

Concept

//Create a ratio.
var ratio = aspect.createRatio(element);

//Dispose (remove element listeners etc.).
ratio.dispose();

Examples

//Create a ratio that will use cover mode when the difference between element and parent ratio is less then 10%. Usefull when containig dynamic sized elements to prevent narrow side bars.
var ratio = aspect.createRatio(element, false);
ratio.autoCoverThreshold = 0.1;
//Create a ratio that will at most scale element size to 125% of parent size.
var ratio = aspect.createRatio(element);
ratio.constrainWidth = 1.25;
ratio.constrainHeight = 1.25;
//Create a ratio that will set the transform matrix instead of the regular width and height style.
var ratio = aspect.createRatio(element);
ratio.useTransform = true;

About

Maintain element ratio

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published