Instance Settings
Customise each targetted paragraph with the settings below (all are optional):
$(selector).more({length: 60});
Note that the plugin expects the targetted paragraph to only contain text, and no other markup.
andNext | ellipsisText | ignoreTags | leeway | length | lessText | moreText | onChange | toggle | wordBreak
Name | Type | Default | Comments |
---|---|---|---|
length | number | 100 | The number of characters shown after truncation. |
leeway | number | 5 | The number of additonal characters allowed before truncation is actually applied.
For example, with the default values, text up to 105 characters would not be
truncated at all, while text over 105 characters would only show the first
100 followed by the ellipsisText and link. |
wordBreak | boolean | false | When false the text is truncated at the character specified by
length , regardless of its position within a word.
When true the text is truncated at the first word boundary before
length . |
ignoreTags | string[] | ['br', 'hr', 'img'] | The list of tags that should be ignored during truncation processing
since they don't require an ending tag. Since 2.0.0 |
toggle | boolean | true | When true the link at the end of any truncated text toggles to allow
the user to collapse the text again. When false the text can be
expanded once but not collapsed again. |
ellipsisText | string | '...' | The text used at the end of a truncation to indicate that more text is available. |
moreText | string | 'Show more' | The text shown on the link to expand the text. |
lessText | string | 'Show less' | The text shown on the link to collapse the text. |
andNext | string | '' | The selector for any following elements to be hidden along with the extra text in the original element.
The selector is applied to jQuery's nextAll function.Since 2.0.1 |
onChange | function | null | A callback function to notify of expansion/collapse.
The function receives one parameter being true if expanded
or false if collapsed. Within the function this
refers to the targetted paragraph.
|