Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ethagnawl/ellipsify
ellipsify is a jQuery plugin that truncates text and appends an ellipsis after a character/word limit.
https://github.com/ethagnawl/ellipsify
Last synced: about 10 hours ago
JSON representation
ellipsify is a jQuery plugin that truncates text and appends an ellipsis after a character/word limit.
- Host: GitHub
- URL: https://github.com/ethagnawl/ellipsify
- Owner: ethagnawl
- Created: 2010-08-18T20:59:03.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-02-07T08:05:55.000Z (almost 14 years ago)
- Last Synced: 2024-11-26T00:12:04.776Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 113 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
ellipsify truncates a text node if a given character/word count is reached, appends an ellipsis (or user specified characters/HTML) and removes any subsequent siblings from the DOM.
Optional arguments:
count: number - supply a character/word count to use as the break point at which text will be truncated and an ellipsis will be appended (25 is the default count value and '...' is the default ellipsis)
ellip: string - supply custom ellipsis (i.e. ***) or hmtl (i.e. View More...)
type: 'chars' or 'words' - truncate text based on character or word count (word count is the default)
ellipsify_class: string - supply a class to override the default class, 'ellipsis' that is added to text node being truncatedUse:
default:
$('p').ellipsify();
- truncates text in thecontaining the 25th word, appends an ellipsis and removes any subsequent sibling elements in the jQuery object from the DOM
count argument:$('p').ellipsify({
count: 75
});
- truncates text in thecontaining the 75th word, appends an ellipsis and removes any subsequent sibling elements in the jQuery object from the DOM
type argument:
$('p').ellipsify({
type: 'chars'
});
- truncates text in thecontaining the 25th character, appends an ellipsis and removes any subsequent sibling elements in the jQuery object from the DOM
ellip argument:$('p').ellipsify({
ellip: 'View More...'
});
- truncates text in thecontaining the 25th word, appends a link to http:/yourdomain.com/article-something-99 and removes any subsequent sibling elements in the jQuery object from the DOM
ellipsify_class argument:
$('#single_p_new_class').find('p').ellipsify({
ellipsify_class:'new-ellipsis'
});
- truncates text in thecontaining the 25th word, adds a user defined class (in place of the default 'ellipsis' class) to the text node being truncated and removes any subsequent sibling elements in the jQuery object from the DOM