You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 21, 2018. It is now read-only.
happen.once(element, options) fires an event once. The element must
be a DOM element. options must have a type for event type, then can
have options:
Keyboard Events
keyCode
charCode
shiftKey
metaKey
ctrlKey
altKey
Mouse Events
detail
screenX
screenY
clientX
clientY
ctrlKey
altKey
shiftKey
metaKey
button
Touch Events
touchstart
touchmove
touchend
varelement=document.getElementById('map');// click shortcuthappen.click(element);// dblclick shortcuthappen.dblclick(element);// custom optionshappen.dblclick(element,{shift: true});// any other event type under MouseEventshappen.once(element,{type: 'mousewheel',detail: -100});// The once api takeshappen.once(// elementelement,{// event type (e.type)type: 'mousewheel',// any other optionsdetail: -100});// touch eventshappen.once(element,{type : 'touchstart',touches : [{pageX : 800,pageY : 800},{pageX : 400,pageY : 400}]});
jQuery Plugin
// Shortcut - 'click' is shorthand for { type: 'click' }$('.foo').happen('click');// Longhand - specify any sort of properties$('.foo').happen({type: 'keyup',keyCode: 50});// Works on any jQuery selection$('.foo, .bar').happen('dblclick');
Shortcuts:
happen.click
happen.dblclick
happen.mousedown
happen.mouseup
happen.mousemove
happen.keydown
happen.keyup
happen.keypress
Use it with a testing framework, like Jasmine
or Mocha.