Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

miguelmota/textnode-offset

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published