[英]How to trigger dragend event
如何强制dragend
事件? 我使用了一个库,该库自动将侦听器添加到查找长按的元素(用于触摸屏以模拟右键单击事件)。 当用户尝试拖动时,我不希望它触发(但拖动的性质意味着,他们单击并按住/长按)
我知道如何设置,但我想要的是
instrumentInfo.addEventListener("dragstart", function (e) {
e.preventDefault();//stop longpress working for touch screens
e.dragend(); //not going to work
instrumentInfo.dispatchEvent("dragend");//does not work
instrumentInfo.dispatchEvent(new Event("dragend"));//no exception but does not seem to work
}
我知道我可能会遇到比赛条件,我可以接受
答案是,执行 mouseup 事件
instrumentInfo.dispatchEvent(new Event("mouseup"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.