Mac Style Text Truncation Plugin For jQuery - truncateMiddle

Mac Style Text Truncation Plugin For jQuery - truncateMiddle
File Size: 7.3 KB
Views Total: 3614
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

truncateMiddle is a jQuery text truncation plugin which truncates strings to a specified length and adds an ellipsis ("...") in the middle of the text as you seen in Apple Finder. Helps in responsive web layout that automatically hides overflowing characters to make your text fit within parent container.

Basic usage:

1. Download and load the jQuery truncateMiddle plugin after loading jQuery JavaScript library.

<script src="//"></script>
<script src="jquery.truncatemiddle.js"></script>

2. Wrap your text into a container.

<p class="demo">Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>

3. Initialize the plugin and we're ready to go.


4. Change the default character length.

  length: 50, // default: 35

5. Change the default ellipsis ("...").

  ellipsis: ' [...] ', // default: '...'

Change log:


  • bugfix

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