Socket
Socket
Sign inDemoInstall

ev-pos

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ev-pos

relative position of mouse/touch events to element


Version published
Weekly downloads
2.1K
decreased by-3.73%
Maintainers
1
Install size
7.30 kB
Created
Weekly downloads
 

Readme

Source

ev-pos

stable

relative position of mouse/touch events to element

Usage

npm i ev-pos

NPM

var evPos = require('ev-pos');

document.querySelector('.some-element').addEventListener('click', function(ev){
    //position relative to ev.currentTarget
    var p1 = evPos(ev);
    //position relative to document.body
    var p2 = evPos(ev, document.body);
});

API

evPos(event, [toElement])

toElement defaults to ev.currentTarget

Example

npm i && npm run test-visual

(expects beefy to be installed globally)

Licence

MIT, see LICENSE.md for details.

Keywords

FAQs

Last updated on 14 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc