Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 37 lines (24 sloc) 2.44 kb
04b9110 updated README; added License
Thorsten authored
1 # jQuery Truncate Text Plugin #
4610845 update README
tagedieb77 authored
2
0c73715 Samuele Arcidiacono Change option center (boolean) to side (string).
djjeck authored
3 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.
4610845 update README
tagedieb77 authored
4 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.
1e95228 add demo.html & README.md
tagedieb77 authored
5
04b9110 updated README; added License
Thorsten authored
6 ## Usage ##
7
1e95228 add demo.html & README.md
tagedieb77 authored
8
9 $('.class').truncate();
10
11 $('.class').truncate({
12 width: 'auto',
210ad67 Kuzeko reducing complexity from O(n) to O(log(n)) and renamed after in token
kuzeko authored
13 token: '…',
0c73715 Samuele Arcidiacono Change option center (boolean) to side (string).
djjeck authored
14 side: 'right',
34e3975 Corey Innis add 'multiline' option
coreyti authored
15 multiline: false
1e95228 add demo.html & README.md
tagedieb77 authored
16 });
17
04b9110 updated README; added License
Thorsten authored
18 ## Options ##
1e95228 add demo.html & README.md
tagedieb77 authored
19
4610845 update README
tagedieb77 authored
20 - **width** (int) Width to which the text will be shortened *[default: auto]*
210ad67 Kuzeko reducing complexity from O(n) to O(log(n)) and renamed after in token
kuzeko authored
21 - **token** (string) Replacement string for the stripped part *[default: '…']*
8565967 Samuele Arcidiacono Support truncating content from the beginning, along with end and center...
djjeck authored
22 - **side** (string) Side from which shorten. Can either be 'left', 'center', 'right' *[default: right]*
4610845 update README
tagedieb77 authored
23 - **addclass** (string) Add a class to the truncated strings element *[default: false]*
24 - **addtitle** (bool) Add/Set "title" attribute with original text to the truncated strings element *[default: false]*
34e3975 Corey Innis add 'multiline' option
coreyti authored
25 - **multiline** (bool) Applies truncation to multi-line, wrapped text *[default: false]*
3bb8315 Kris Erickson Add assumeSameStyle doc.
kriserickson authored
26 - **assumeSameStyle** (bool) When working with multiple elements with the same style, cache the style for improved performance *[default: false]*
04b9110 updated README; added License
Thorsten authored
27
28 ## License ##
29
cff14b1 Thorsten Basse updated README.md
authored
30 Copyright (c) 2012-2013 Thorsten Basse and contributors
31
32 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
33
34 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
35
36 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.