A lightweight vanilla javascript read more button for expanding and collapsing blocks of text.
- Choose how many text to keep and collapse the rest to create a teaser.
- Can be used in more than one article block.
Download the latest version of read-more-btn-v1.x.js file
include it in your HTML page:
<script src="scripts/read-more-btn-v1.x.js"></script>
include another script tag and call its function
Syntax:
mkBtn[Tag name][,<# of words: number>]) Where tag name is the article element and the number of of words is the number of visible text words.
<script>
mkBtn('article',20)
</script>
Thats it.
- Fix page rendering when clicking on a button
-
Add support for multiple articles. - Add support for class and id and other tags
This app is under MIT license