Fewlines

This project is maintained by sergeir82

Welcome to Fewlines plugin page.

Fewlines - is a lightweight jQuery plug-in to cut the text to a specified number of rows. The plugin was written in CoffeeScript, and easy to use:

$('#sample').fewlines();

Plugin options

Option Default Description
lines 2 The number of lines that you want to show. If amount of text less than a specified number of lines, the text will remain as is.
openMark '...' Open mark label
newLine false If this option is true the open mark is placed on new line
closeMark 'close' Close mark label

Some demos

$('#sample-1').fewlines();
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam, eius, libero laudantium ratione eos minus reprehenderit. Dolorem, quam, voluptatibus, eos, aut harum illum doloremque modi ab ducimus fugit impedit eius?
$('#sample-2').fewlines({lines : 4});
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam, eius, libero laudantium ratione eos minus reprehenderit. Dolorem, quam, voluptatibus, eos, aut harum illum doloremque modi ab ducimus fugit impedit eius?
$('#sample-3').fewlines({openMark : 'some open mark', closeMark : 'other close mark', newLine: true});
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam, eius, libero laudantium ratione eos minus reprehenderit. Dolorem, quam, voluptatibus, eos, aut harum illum doloremque modi ab ducimus fugit impedit eius?

Test cases

Page with tests on qUnit

Support or Contact

Having trouble with this plugin? You can contact with me https://www.facebook.com/sergey.ratnikov.52 or http://vk.com/sergeir82.