-
Notifications
You must be signed in to change notification settings - Fork 0
ethagnawl/ellipsify
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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. <a href="/article-something-99">View More...</a>) 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 truncated Use: default: $('p').ellipsify(); - truncates text in the <p> containing 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 the <p> containing 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 the <p> containing the 25th character, appends an ellipsis and removes any subsequent sibling elements in the jQuery object from the DOM ellip argument: $('p').ellipsify({ ellip: '<a href="/article-something-99">View More...</a>' }); - truncates text in the <p> containing 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 the <p> containing 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
About
ellipsify is a jQuery plugin that truncates text and appends an ellipsis after a character/word limit.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published