Skip to content

Files

Latest commit

de63877 · May 19, 2021

History

History
45 lines (28 loc) · 980 Bytes

README.md

File metadata and controls

45 lines (28 loc) · 980 Bytes

Read more button

A lightweight vanilla javascript read more button for expanding and collapsing blocks of text.

demo

Features

  • Choose how many text to keep and collapse the rest to create a teaser.
  • Can be used in more than one article block.

Use

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.

To do

  • Fix page rendering when clicking on a button
  • Add support for multiple articles.
  • Add support for class and id and other tags

License

This app is under MIT license