vmousecancel


vmousecancel eventversion added: 1.0

Description: Virtualized mousecancel event handler.

  • jQuery( ".selector" ).on( "vmousecancel", function( event ) { ... } )

We provide a set of "virtual" mouse events that attempt to abstract away mouse and touch events. This allows the developer to register listeners for the basic mouse events, such as mousedown, mousemove, mouseup, and click, and the plugin will take care of registering the correct listeners behind the scenes to invoke the listener at the fastest possible time for that device. In touch environments, the plugin retains the order of event firing that is seen in traditional mouse environments, so for example, vmouseup is always dispatched before vmousedown, and vmousedown before vclick, etc. The virtual mouse events also normalize how coordinate information is extracted from the event, so in touch based environments, coordinates are available from the pageX, pageY, screenX, screenY, clientX, and clientY properties, directly on the event object.

The jQuery Mobile vmousecancel event handler is called whenever the system cancels a virtualized mouse event. This event occurs when a scroll is triggered. jQuery Mobile will fire a "vmousecancel" event in this instance.

This plugin extends jQuery's built-in method. If jQuery Mobile is not loaded, calling the .vmousecancel() method may not fail directly, as the method still exists. However, the expected behavior will not occur.

The virtual mouse events can also be configured:

  • $.vmouse.moveDistanceThreshold (default: 10px) – More than this, then it is a scroll event. The vmousecancel event is called and the TouchMove event is cancelled.
  • $.vmouse.clickDistanceThreshold (default: 10px) – If a vclick event was already captured and is in the block list, then vclicks less than this distance are ignored.
  • $.vmouse.resetTimerDuration (default: 1500ms) – More time than this, then it is not a touch event. Scroll, TouchMove and TouchEnd events use this. The block list is cleared.