Truncate Text With Ellipsis - Download Truncate Text With Ellipsis Using jQuery - Text-Ellipses

Download Truncate Text With Ellipsis Using jQuery – Text-Ellipses

Posted on

This time I will share jQuery Plugin and tutorial about Truncate Text With Ellipsis Using jQuery – Text-Ellipses, hope it will help you in programming stack.

Truncate Text With Ellipsis - Download Truncate Text With Ellipsis Using jQuery - Text-Ellipses
File Size: 3.98 KB
Views Total: 814
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Text-Ellipses is a very small jQuery text truncation plugin which can be used to shorten text with ellipsis inside a specific DOM element.

The plugin dynamically adds custom text to your DOM elements and truncate the text to a number of characters you specify.

Also supports the hoverExpand functionality that enables the user to reveal the full text on mouse hover.

How to use it:

1. Import jQuery JavaScript library and the jQuery Text-Ellipses plugin’s script into the html document.

2         integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
3         crossorigin="anonymous">
4 </script>
5 <script src="src/text-ellipses.jquery.js"></script>

2. Add text to your DOM element and specify the number of characters to preserve after truncating.

1 <a href="#" id="link"></a>
1 $('a').textEllipses("Long Text Here", 5)

3. Decide whether or not to enable the title attribute.

1 $('a').textEllipses("Long Text Here", 5,{
2   showTitle: true
3 })

4. Apply custom styles to the DOM elements after the text has been truncated.

1 $('a').textEllipses("Long Text Here", 5,{
2   className: 'text-ellipsis-element'
3 })
1 .text-ellipsis-element {
2   /* your styles here */
3 }

5. Toggle the visibility of the truncated text on mouse hover.

1 $('a').textEllipses("Long Text Here", 5,{
2   hoverExpand: true
3 })

This awesome jQuery plugin is developed by notetech. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net