[英]Javascript or jquery to auto double click at specific location after single click
My website has a button that works after double click but it seems that users don't know that it works on double click, therefore they don't click it two times. 我的网站上有一个可以在双击后起作用的按钮,但是用户似乎不知道它可以在双击后起作用,因此他们没有两次单击它。 Is there any javascript or jquery method that automatically double clicks at specific location after single is done ?
是否有任何javascript或jquery方法在完成一次单击后自动在特定位置双击? Thanks for your answers
谢谢你的回答
Try to trigger double click
within the click
event. 尝试在
click
事件中触发double click
。
$('selector').on('click', function () {
$(this).trigger('dblclick');
});
But I feel that if they double click it, then dblclick
will be executed twice. 但是我觉得如果他们双击它,那么
dblclick
将被执行两次。 Instead try to show some messages like "double click to get it worked" inorder to show users. 而是尝试显示一些消息,例如“双击以使其起作用”,以便向用户显示。
From @James Allardice's answer , 从@James Allardice的答案中 ,
it seems that there is going to be no reliable way to determine whether the user intended a double click or two single clicks, but if you want to try, you could perhaps use setTimeout in a click event handler to see if another click occurs within a certain period of time.
似乎没有可靠的方法来确定用户是想要双击还是两次单击,但是如果您想尝试,则可以在点击事件处理程序中使用setTimeout来查看是否在点击事件处理程序中发生了另一次点击。一定的时间。
If you still need to have this, then go for @Paolo Bergantino's hack . 如果仍然需要此功能,请使用@Paolo Bergantino的技巧 。
$( "#your_tag_id" ).click(function() {
$( "#your_tag_id" ).dblclick();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.