jquery-truncate-html

WebJar for jquery-truncate-html

License

License

MIT
Categories

Categories

Github Development Tools Version Controls
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

github-com-alexander-elgin-jquery-truncate-html
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

jquery-truncate-html
WebJar for jquery-truncate-html
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/alexander-elgin/jquery-truncate-html

Download github-com-alexander-elgin-jquery-truncate-html

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/github-com-alexander-elgin-jquery-truncate-html/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>github-com-alexander-elgin-jquery-truncate-html</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-alexander-elgin-jquery-truncate-html/
implementation 'org.webjars.bower:github-com-alexander-elgin-jquery-truncate-html:0.0.1'
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-alexander-elgin-jquery-truncate-html/
implementation ("org.webjars.bower:github-com-alexander-elgin-jquery-truncate-html:0.0.1")
'org.webjars.bower:github-com-alexander-elgin-jquery-truncate-html:jar:0.0.1'
<dependency org="org.webjars.bower" name="github-com-alexander-elgin-jquery-truncate-html" rev="0.0.1">
  <artifact name="github-com-alexander-elgin-jquery-truncate-html" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='github-com-alexander-elgin-jquery-truncate-html', version='0.0.1')
)
libraryDependencies += "org.webjars.bower" % "github-com-alexander-elgin-jquery-truncate-html" % "0.0.1"
[org.webjars.bower/github-com-alexander-elgin-jquery-truncate-html "0.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bower : jquery jar [2.1.1,2.2)

Project Modules

There are no modules declared in this project.

Build Status

Install

Bower

bower install jquery-truncate-html

NPM

npm install jquery-truncate-html

Usage

jQuery.truncate(html, options)

> jQuery.truncate('<p>Stuff and <i>Nonsense</i></p>', {
  length: 13
});
'<p>Stuff and <i>No…</i></p>'

$el.truncate(options)

> jQuery('<p>Stuff and <i>Nonsense</i></p>').truncate({
  length: 13
}).html();
'<p>Stuff and <i>No…</i></p>'

Options

Default options are stored on jQuery.truncate.defaults.

length

Default: Infinity

The maximum length (including the ellipsis) of the truncated html.

stripTags

Default: false

If stripTags is truthy all html tags will be stipped, leaving only the text.

> jQuery.truncate('<p>Stuff and <i>Nonsense</i></p>', {
  length: 13,
  stripTags: true
});
'Stuff and No…'

words

Default: false

If words is truthy the input will only be truncated at word boundaries.

> jQuery.truncate('<p>Stuff and <i>Nonsense</i></p>', {
  length: 13,
  words: true
});
'<p>Stuff and…</p>'

noBreaks

Default: false

If noBreaks is truthy the input will contain no break elements.

> jQuery.truncate('<p>Stuff and<br><i>Nonsense</i></p>', {
  length: 13,
  noBreaks: true
});
'<p>Stuff and <i>No…</i></p>'

ellipsis

Default: '…'

The ellipsis setting is used to provide a different character for the ellipsis.

> jQuery.truncate('<p>Stuff and <i>Nonsense</i></p>', {
  length: 13,
  ellipsis: '~'
});
'<p>Stuff and <i>No~</i></p>'

Versions

Version
0.0.1