Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
Problem with ons.GestureDetector / onmousedown
-
Hi there,
I am working on an little App with OnsenUI and want to implement a hold-interaction on a dynamically generated div. If possible, I don’t want to dynamically register & destroy multiple event-Handlers, but would rather have something in the style of the onclick-property:
<div id="something" onclick="myFunction()"></div>
I tried to find any example using the ons.GestureDetector but could not find any without registering event-handlers. Then I switched to simple javascript and tried to do a custom solution with the onmousedown and onmouseup -properties:
<div id="something" onmousedown="startTimer()" onmouseup="stopTimer()"></div>
This should work, but I noticed some strange behaviour I can’t explain: The oonmousedown and onmouseup event are only triggered when I do a normal click on the div. If I press down and hold, the events ARE NOT fired. I do have a ons-ripple element insied the div, but even without this, the onmousedown is not triggered when I hold the mousebutton.
Is this something related to OnsenUI? Does Onsen somehow redirect clicks? Or is this another problem I do not see?
thanks in advance for any response!
Maenny