0.0.3 • Published 7 years ago

textnode-offset v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

textnode-offset

Get the offset of a character by wrapping it in a textNode.

Demo

https://lab.miguelmota.com/textnode-offset

Install

npm install textnode-offset
bower install textnode-offset

Usage

<div id="text">Programs must be written for people to read, and only incidentally for machines to execute.</div>
var parentElement = document.getElementById('text');
var index = 20;
var offset = textNodeOffset(parentElement, index);

console.log(offset);
//
{
  "left": 148.875,
  "top": 110.875
}

License

MIT