rubberband
Unapologetically evergreen-only supporting iframe resizer
Usage
1. Browserify
import {content} from 'rubber-band';
content();
- In your embedded document
import {host} from 'rubber-band';
let els = document.querySelectorAll('.js-rubberband');
let frames = Array.prototype.slice.call(els).map(host);
2. Plain old javascript files
<body>
<iframe src="./content.html" class="js-rubberband">
<script src="rubberband/distribution/rubber-band.host.min.js" async="async"></script>
</body>
- In your embedded document
<body>
<script src="rubberband/distribution/rubber-band.content.min.js" async="async"></script>
</body>
API
rubberband.host(frame /* frame element */, options /* options object */);
{
"name": "rubberband",
"domain": "*",
"throttle": 300
"callback": function defaultCallback(frame, height) {
frame.style.height = `${height}px`;
}
}
{
start(),
stop(),
request()
}
rubberband.content(options /* options object */);
{
"name": "rubberband",
"domain": "*",
"throttle": 300
}
{
start(),
stop(),
}