Skip to content

Instantly share code, notes, and snippets.

@jzelenkov
Created October 29, 2014 06:43
Show Gist options
  • Save jzelenkov/3aa6016e50838448591b to your computer and use it in GitHub Desktop.
Save jzelenkov/3aa6016e50838448591b to your computer and use it in GitHub Desktop.
// /////////////////////////////////////////////
// // hover pointer to the middle of the element
// /////////////////////////////////////////////
// moveMouseTo : function moveMouseTo(selector) {
// var element = document.querySelector(selector);
// var evt = element.ownerDocument.createEvent('MouseEvents');
// // clientX value: 516
// // clientY value: 105
// // screenX value: 560
// // screenY value: 200
// evt.initMouseEvent('mousemove', true, true,
// element.ownerDocument.defaultView, 1,
// // screenX, screenY, clientX, clientY,
// 0, 0, 0, 0,
// // 560, 200, 516, 105,
// false, false, false, false, 0, null);
// element.dispatchEvent(evt);
// if (document.createEventObject) {
// // dispatch for IE <= 9
// return element.fireEvent('onclick', evt)
// } else {
// // dispatch for normal browsers
// return !element.dispatchEvent(evt);
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment