Detect where the text wraps in Javascript
JavaScript
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
src First release Jan 6, 2014
tests First release Jan 6, 2014
.gitignore First release Jan 6, 2014
LICENSE Initial commit Jan 6, 2014
README.md Updated Readme with bower install Jan 6, 2014
bower.json Added bower.json Jan 6, 2014
demo.html First release Jan 6, 2014
karma.conf.js First release Jan 6, 2014
package.json 0.0.1 Jan 6, 2014

README.md

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