Skip to content

JQuery Plugin to ellipsis text after a select number of lines.

Notifications You must be signed in to change notification settings

vijedi/Line-Ellipsis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

JQuery Plugin For Line Based Ellipsis

Line Ellipsis is a jQuery plugin inspired by (jquery-ellipis)[https://github.com/sakura-sky/jquery-ellipsis].

Unlike Ellipsis which works on element height, Line Ellipsis truncates text based on the number of requested lines. The number of requested lines are defined through jQuery Metadata.

Usage

To invoke Line Ellipsis on a specific element, use the following:

$('selector').lineEllipsis();

The required peice of Metadata is the number of lines:

<div class="lineEllipsis {numLines: 2}">This is a whole lot of text that should only render as one line</div>

The plugin also supports truncating a child element. This can be useful with generated elements:

<div class="lineEllipsis {numLines: 2, child: a}"><a href="http://tejusparikh.com">This is the text that will be truncated</a></div>

Known Issues

Performance: The plugin doesn't do a good job of identifying character widths. Therefore it does more string concatinations than strictly necessary

Nested Elements: The plugin does not work with nested elements within the section that will be truncated. If you have nested elements, you will likely lose close tags and your page will look incorrect.

About

JQuery Plugin to ellipsis text after a select number of lines.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published