elements[0].onmousedown = function(){
console.log('screen clicked.');
simulatemouseuphere;
};
All I need to do is add something in my function that triggers mouseup, even if the user is holding the click button down.
elements[0] is my entire page scope, so anywhere you click, it will trigger.
I'm pretty sure you can just call the onmouseup event...
elements[0].onmousedown = function(){
console.log('screen clicked.');
elements[0].onmouseup();
};
Keep in mind that when you actually physically stop holding the mouse down though, the mouseup event will be triggered again. (unless in the onmouseup() event you manage that)
Tested quickly, looks like it works: http://jsfiddle.net/cUCWn/40/
$("body").on("mousedown", function(e)
{
e.type = "mouseup";
$(this).trigger(e);
}).on("mouseup", function(e)
{
console.info(e);
});
Or: https://stackoverflow.com/a/12724570/2625561
For pure JS: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events#Triggering_built-in_events
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With