1.0.1 • Published 8 years ago

dom-aspect v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

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;