node package manager

Introducing npm Enterprise add-ons. Integrate third-party dev tools into npm…


synthesized mouse cursor


for when you've got a fullscreen game, but you want a cursor.

var interact = require('interact')
  , cursor = require('./index')
  , element
var pointer = interact(document.body)
  , current
pointer.on('attain', function(movements) {
  var to = current = cursor(element, true)
  element = to.element
document.body.onclick = function(ev) {
  if(current) {

creates a cursor element if none is given, and returns it as a writable stream suitable for piping interact movement streams into.

if constrainToWindow isn't given, it defaults to true; the cursor will not be able to leave the window.

if dispatchHover isn't given, it defaults to false; enabling it will dispatch mouseover and mouseout events to the elements hovered. note that this is experimental and slow.

dispatch a click event to the currently hovered element.

the element representing the cursor.

the element currently hovered.

set whether or not to constrain mouse movements. if setting to true, will recalculate window size and re-constrain the existing cursor.