Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery plugin to "see more" text

i am looking for a jQuery plugin that does this:

original:

i am such a nice guy that just needs to become a lot more concise.... help me... help me...

needed

i am such a nice guy that... [see more]

Requirements:

  • cut by word, not character length
  • very light and simple, no mess needed!
like image 603
meow Avatar asked Dec 06 '22 23:12

meow


1 Answers

I just hacked this together.

You can use it by calling trunc on all of the elements you want to have a see more label on. You pass it an argument of the maximum number of words in the un-expanded text.

Example:

// truncate all text in elements with class "truncateme" to be 10 words or less
// (until you click the "see more" link)
$(".truncateme").trunc(10);
like image 164
icktoofay Avatar answered Dec 27 '22 20:12

icktoofay