This article describes how to implement the coexistence of click and double-click in javascript. It is a very practical technique to determine the effect of click and double-click by defining the interval of the second click, for more information, see the examples in this article. Share it with you for your reference. The specific analysis is as follows:
During webpage development, we often encounter such a problem: register a double-click event for a link, or register a click or double-click event with a button or other elements, at this time, we found that double-click events on the Web page never seem to work, because when we click once, they are intercepted by hyperlinks or click events, this article describes how to solve this technical problem. The implementation principle of this solution is to call the same method for clicking an event or double-click an event. We can determine whether to click or double-click an event based on the interval between two mouse clicks. When you click an event, do not call it. Wait for a short period of time. After this period of time, if you do not have the next click, start to call and click the corresponding operation, double-click is called for the next click.
For details, see the following code list:
The Code is as follows:
Click and double-click in javascript