vmouseup


vmouseup eventversion added: 1.0

Description: Virtualized mouseup event handler.

  • jQuery( ".selector" ).on( "vmouseup", 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 "vmouseup" event handler simulates the "onmouseup" event handler on mobile devices.

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

1
2
3
$( document ).on( "vmouseup", "p", function() {
$( this ).append( "<span style='color:#108040;'> vmouseup 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.