https://github.com/micjamking/Succinct
A tiny jQuery plugin for truncating multiple lines of text
https://github.com/micjamking/Succinct
Last synced: 4 months ago
JSON representation
A tiny jQuery plugin for truncating multiple lines of text
- Host: GitHub
- URL: https://github.com/micjamking/Succinct
- Owner: micjamking
- License: mit
- Created: 2013-07-22T23:07:08.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2018-04-24T20:09:43.000Z (almost 8 years ago)
- Last Synced: 2025-10-22T16:33:18.076Z (5 months ago)
- Language: JavaScript
- Homepage: http://mikeking.io/succinct/
- Size: 42 KB
- Stars: 477
- Watchers: 27
- Forks: 65
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-frontend - Succinct - 用作截断多行文本,后面添加省略号
- awesome-frontend - Succinct - 用作截断多行文本,后面添加省略号
- awesome-front-end - Succinct - 用作截断多行文本,后面添加省略号
README
Succinct
========
> A *tiny* jQuery plugin for truncating multiple lines of text
## How does it work?
Succinct shortens your text to a specified size, and then adds an ellipsis to the end.
## Demo
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. `
` to 120 characters...
```html
$(function(){
$('.truncate').succinct({
size: 120
});
});
```
By default, the plugin truncates text to 240 characters.
To change the ellipsis to an HTML unicode arrow "→"...
```html
$(function(){
$('.truncate').succinct({
omission: '→'
});
});
```
By default, the plugin also removes the set of 32 ASCII special characters at the end of words, ie. `! " # $` and so on. To disable this behavior...
```html
$(function(){
$('.truncate').succinct({
ignore: false
});
});
```
## Details
* *Succinct is < 0.6kb minified
* You'll need a copy of [jQuery](http://code.jquery.com/jquery-latest.min.js) to run this plugin
* Suggestions, comments, or creative insults: [add an issue](https://github.com/micjamking/succinct/issues/new) or [fork the repo](https://github.com/micjamking/succinct/fork).
## Copyright
[MIT license](http://opensource.org/licenses/MIT) Copyright (c) 2014 Mike King ([@micjamking](http://twitter.com/micjamking))