textnode-offset

0.0.3 • Public • Published

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

Package Sidebar

Install

npm i textnode-offset

Weekly Downloads

3

Version

0.0.3

License

MIT

Last publish

Collaborators

  • miguelmota