jquery-truncate | Simple plugin that truncates a text either | User Interface library
kandi X-RAY | jquery-truncate Summary
kandi X-RAY | jquery-truncate Summary
Simple plugin that truncates a text either at its end or middle based on a given width or it's elements width. The width calculation takes into account all the original elements css styles like font-size, font-family, font-weight, text-transform, letter-spacing etc. Additionally if the text has been shortened you can set a class to be appended to the element and/or set the "title" attribute to the original text.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of jquery-truncate
jquery-truncate Key Features
jquery-truncate Examples and Code Snippets
Community Discussions
Trending Discussions on jquery-truncate
QUESTION
I have multiple items in a div with paragraphs and I would like to truncate them to 2 lines. I have tried to truncate using the height but it results in cut off words. I can't use characters because in some cases the words are long and get pushed to a new line.
I am trying to work with getClientRects() as you'll see in the fiddle below. Also note that I can't use any plugins for the project I am working on.
I found this example on another post: Working Truncate from stackoverflow post
My Fiddle: JS Fiddle
...ANSWER
Answered 2019-Jan-11 at 01:21Using the css answer from css-tricks (https://css-tricks.com/line-clampin/) assuming you know the line-height.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jquery-truncate
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page