vmousedown eventversion added: 1.0

Description: Virtualized mousedown event handler.

  • jQuery( ".selector" ).on( "vmousedown", 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, vmousedown is always dispatched before vmouseup, and vmouseup 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 vmousedown event handler simulates the "onmousedown" event handler on mobile devices.

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

$( function () {
$( document ).on( "vmousedown", "p", function() {
$( this ).append( "<span style='color:#108040;'> vmousedown fired...</span>" );

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.