Jquery plugin to view more text

I am looking for a jQuery plugin that does this:

original:

I am such a nice guy who just needs to be much more concise ... help me ... help me ...

is necessary

I am such a good guy that ... [more]

Requirements:

  • shortened word, not character length
  • very light and simple, mess is necessary!
+4
source share
2 answers

I just hacked this together.

You can use it by calling trunc for all the elements on which you want to see a larger label. You pass it the argument of the maximum number of words in the unextended 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); 
+14
source

If CSS3 is an option for you, you can use the text-overflow property.

If not, here is a list of jQuery plugins that do what you are looking for

+1
source

Source: https://habr.com/ru/post/1336246/


All Articles