@springernature/global-expandable-box

v0.1.0
height of box expands and contracts

To use expandable box:

import init from './expandable.js';
var boxArray = Array.from(document.querySelectorAll('.box')); 
init(boxArray);

The init function can take additional arguments to specify a maximum height and button text for when the box is closed and open.

function init(boxes, "90px", "close", "open")

The default values are a height of "200px", closetext of "Show less" and opentext of "Show more".

Expandable box offers two custom event listeners - open and close.

box.addEventListener('close', function() {
    console.log('closed!!');
})
npm i @springernature/global-expandable-box

Metadata

  • MIT
  • Whatever
  • Ollie Williams
  • released 6/22/2018

Downloads