dom position functions

npm install dom.position
2 downloads in the last week
6 downloads in the last month


get the coordinates of the element relative to the document


mouse coordinates inside of an element

var pos = require('dom.position');

div.addEventListener('mouseclick', function(ev) {
    var ppos = pos(ev.currentTarget);

    var x = ev.clientX - ppos.left;
    var y = ev.clientY -;

    // coordinates {x,y} are relative to the click container
npm loves you