Skip to content

xdamman/js-line-wrap-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsLineWrapDetector

Detect where the text wrap in any dom element.

Installation

Just clone this repo or better, use bower:

bower install js-line-wrap-detector

Usage

<script src="src/lineWrapDetector.js"></script>
<script>
var ps = document.getElementsByTagName('p');
var p = ps[0];
var lines = lineWrapDetector.getLines(p);
console.log(lines.length+" lines: ", lines);
</script>

With RequireJS:

<script>
require(['src/lineWrapDetector'], function(detector) {
  var ps = document.getElementsByTagName('p');
  var p = ps[0];
  var lines = detector.getLines(p);
  console.log(lines.length+" lines: ", lines);
});
</script>

Tests

npm install; npm test

About

Detect where the text wraps in Javascript

Resources

License

Stars

Watchers

Forks

Packages

No packages published