The object-fit tools library for orxapi. A polyfill for browsers that don't support the object-fit CSS property. Unsure of what the object-fit does? Essentially object-fit is to tags what background-size is to background-image. You can check out the MDN page for more details.
Getting Started
If you haven't used NodeJs before, be sure to have install the LTS version on your desktop ! Check your version with this command:
This library is written in TypeScript, but you can use JavaScript.
$3
Download the script here and include it (unless you are packaging scripts somehow else):
Standalone: You can use the standalone version into bundle directory. The bundle contains a minimized version of the object-fix tools with a Fuse Box Quantum API. `html
`
Min: If you want use other orxapi tools or plugins choose the min bundle and add external api. `html
... ` You access to the methods by the namespace "orxapiToolsObjectfit" see the exemple JavaScript
$3
Tools Object-fit supports npm under the name "orxapi.tools.objectfit".
Usage
TypeScript code `ts import { initObjectFit } from "orxapi.tools.objectfit";
// Default initialization initObjectFit();
// Add conditional handler for by example Blazy library initObjectFit({condition: handleConditionSuccess});
/** * Handler of the condition success object fit * @param {HTMLImageElement} img * @return {boolean} */ function handleConditionSuccess(img: HTMLImageElement) { return img.classList.contents("b-lazy") ? img.classList.contents("b-loaded") : true; }