UnderZ

Javascript Library.

Bind or trigger a mouse up event on an element.

Execute a function when the left, middle or right mouse button is released while the mouse is over the element. or trigger mouseup event for an element.


Bind mouseup event

_z(selector).mouseup(function);

Returns: Object _z(selector)

This method is a shortcut for _z(selector).on( “mouseup”, function).

To unbind mouseup event: Unbind mouseup event


Trigger mouseup event

_z(selector).mouseup();

Returns: Object _z(selector)


Unbind mouseup event

_z(selector).un("mouseup", [function]);

Returns: Object _z(selector)


Examples

<button id="button">Show Message & Change Title</button>
<button class="btnCTitle">Change Title</button>
<button class="btnUBEvent">Unbind "Change Title" event</button>

<script>
// bind mouseup event by element id
_z("#button").mouseup(function () { 
	alert("Mouse button up!");
});

// bind mouseup event by element tag - this will bind the event with all elements with "button" tag.
_z("button").mouseup(function () { 
// set title as the element button text
	document.title = _z(this).text();
});

// unbind mouseup event by element class.
_z(".btnUBEvent").click(function () {
	_z(".btnCTitle").un("mouseup");
});


// trigger mouseup event
_z(".btnCTitle").mouseup(); // change document title to 'Change Title'
_z("#button").mouseup(); // alert 'Mouse button up!' and change document title to 'Show Message & Change Title'
_z(".btnUBEvent").click(); // change document title to 'Unbind "Change Title" event' and unbind mouseup event on .btnCTitle button
</script>

Recommended: bind events in .ready() to execute the event when the document is fully loaded.