Skip to content

A lightweight vanilla JavaScript app for expanding and collapsing blocks of text.

License

Notifications You must be signed in to change notification settings

gumbol/read-more-btn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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