I have a table row and I want to have two functions when I click on this. With a long-press I want to select the row (add an ".active_row" class) and with a normal click I want to open the details site for this dataset.
For the long-press detection I use the third party script found here. With little modifications it works for me and fires the event "long-press" correctly. But the problem now is, if I release the mousebutton the events mouseup and click are fired too...
I compared the event details of the automatic fired after longpress-click and the manual fired click and they are identic. So I can't distinguish it with this.
Any ideas?
The third party script fires the custom long-press event with this after the mousebutton is down for 500ms. it uses the events mousedown and a simple timeout function:
this.dispatchEvent(new CustomEvent('long-press', { bubbles: true, cancelable: true }));
isLongPress
totrue
. Inside the onlick you can then set the variable tofalse
again. – Competency