0.1.0 • Published 6 years ago

@springernature/global-expandable-box v0.1.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

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!!');
})