Coder Social home page Coder Social logo

btnwtn / ellipsis.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glinford/ellipsis.js

0.0 1.0 0.0 20 KB

Ellipsis.js - Pure Javascript Library to handle multilines ellipsis

Home Page: https://glinford.github.io/ellipsis.js/

JavaScript 61.44% HTML 38.56%

ellipsis.js's Introduction

Ellipsis.js

Ellipsis.js is a Pure Javascript Library to add some ellipsis on some complex DOM elements such as multiline divs or elements with childs (links, spans, etc..). The library is fully responsive, works across all major browsers, and try to be highly configurable. It is also very light, with a size of 3.4kb when minified.


Demo:

https://glinford.github.io/ellipsis.js/


Installation:

Bower

bower install ellipsis.js

NPM

npm install ellipsis.js

Or ..

git clone https://github.com/glinford/ellipsis.js

Usage:

<script src="/your/path/ellipsis.min.js"></script>
<script type="text/javascript">
  Ellipsis(); //default conf
</script>

By default Ellipsis.js will work on DOM elements that have a 'clamp' class and will add ellipsis after 2 lines.


Configuration properties:

{
  ellipsis: '...', //default ellipsis value
  debounce: 100, //if you want to chill out your memory usage on resizing
  responsive: true, //if you want the ellipsis to move with the window resizing
  class: '.clamp', //default class to apply the ellipsis
  lines: 2 //default number of lines when the ellipsis will appear
  portrait: null //default no change, put a number of lines if you want a different number of lines in portrait mode
}

Known Issues:

By default the line-height property of a text is 'normal' which cannot be computed with getComputedStyle() method. If that occurs we will replace the line-height from normal to font-size + 2px which is the default value for most of browsers/OS.


ellipsis.js's People

Contributors

glinford avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.