Skip to content

jerome-birembaut/nss-ellipsis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version

With NSS-Ellipsis you can add ellipsis to multiline text

Setup

NSS-Ellipsis can be installed with npm or simply using a content delivery network (CDN) URL to embed NSS-Ellipsis directly on your HTML page.

NPM Install

npm install nss-ellipsis

The correct way to import NSS-Ellipsis is:

import NSSEllipsis from 'nss-ellipsis'
NSSEllipsis.update(element, 3)
// to set precision to letter
NSSEllipsis.update(element, 3, NSSEllipsis.LETTER_PRECISION)

Using common file:

<script async src="../dist/nss-ellipsis.common.js"></script>

Latest Release can be downloaded here

https://github.com/jerome-birembaut/nss-ellipsis/releases/tag/0.0.10

Current features

  • ellipsis a dom element (yeah)
  • lineMax
  • precision to word or letter

Basic Usage Example

const element = document.getElementById(id)
const lineMax = 3
NSSEllipsis.update(element, lineMax)
// it's Responsive Baby!!!
const lineMax = 2;
const onResize = function() {
  [...document.querySelectorAll(".to-ellipsis")].map(element => {
    NSSEllipsis.update(element, 3)
  })
}
window.addEventListener('resize', onResize)
onResize()

BUILD API

npm install
npm run build

License

This content is released under the (http://opensource.org/licenses/MIT) MIT License.

About

add ellipsis to multiline text

Resources

Stars

Watchers

Forks

Packages

No packages published