Succinct: A tiny jQuery plugin for truncating multiple lines of text
Succinct shortens your text to a specified size, and then adds an ellipsis to the end. Simple and to the point.
Live Demo: http://micjamking.github.io/succinct/
Usage
Specify the elements that you would like to truncate as a selector, and then set the size parameter to the amount you would like to see. For example, if you would like to truncate all elements with a specific class, ie. <p class="truncate"> to 120 characters...
<script>
$(function(){
$('.truncate').succinct({
size: 120
});
});
</script>
By default, the plugin truncates text to 240 characters.
Details
- * Succinct is < 0.5kb minified
- You'll need a copy of jQuery to run this plugin
- If you have any suggestions, comments, or creative insults for my code, add an issue or fork the repo.
Written by Mike King
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Typography
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#