Skip to content

Latest commit

 

History

History
71 lines (52 loc) · 1.53 KB

README.md

File metadata and controls

71 lines (52 loc) · 1.53 KB

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.