jqueryjquery-plugins

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:


Solution

  • 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);