JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 43
  • Score
    100M100P100Q32729F
  • License MIT

Wrap an element in a container to force it to a specific aspect ratio.

Package Exports

  • aratio

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aratio) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Aratio

A function to add a container to an element to force it to a specific aspect ratio.

Installation

npm install aratio

or

yarn add aratio

Usage

HTML

<div id="my-element" aspect-ratio="16x9">...</div>

JS

import aratio from 'aratio';
// OR
var aratio = require('aratio');

var element = document.getElementById("my-element");
aratio(element);

// Or to trigger the function on all elements with the aspect-ratio attribute:

var elements = document.querySelector("[aspect-ratio]");
elements.forEach(function(element) {
    aratio(element);
});