Skip to content

joycetipping/jquery.truncate.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Truncate.js

My very first jQuery plugin! It started out as an exercise, but turned into a fun little something that I can see myself using someday.

The function is called by grabbing a div using jQuery and applying the truncate function to it:

$('poem').truncate();

You can pass in an object with the following options (these are the defaults):

{ new_box        : true,
  lines_visible  : 3,
  line_height_px : 20,
  more_text      : 'more',
  less_text      : 'less' }

To style the contents of the truncated box, use class truncate for the box and toggle-link for the toggle link.

Open index.html for a quick demo.

About

A jQuery plugin that truncates text to a specified number of lines

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published