Expand and collapse lists
JavaScript CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test Initial commit Sep 11, 2012
.gitignore Initial commit Sep 11, 2012
Makefile Initial commit Sep 11, 2012
Readme.md Initial commit Sep 11, 2012
component.json add .license property to component.json Oct 28, 2012
index.js Initial commit Sep 11, 2012
more.css Initial commit Sep 11, 2012
package.json add repository field to readme Aug 21, 2013

Readme.md

more

Expand and collapse lists.

Installation

$ component install component/more

Example

var more = require('more');
var list = document.querySelector('ul');

more(list)
  .max(5)
  .more('Show more')
  .less('Show less')
  .render();

API

More#max(n)

Change max number of list items shown when collapsed, defaults to 5.

More#more(label)

Change label from default of "More".

More#less(label)

Change label from default of "Less".

More#render()

Render the list, adds the appropriate more / less link depending on the state.

More#expand()

Expand the list and re-render.

More#collapse()

Collapse the list and re-render.

More#state

String representing the state. Either "expanded", or "collapsed".

License

MIT