Jquery Click Event and double-click event conflict solution, jquery Solution
I need to add a double-click event to the Tree node of bootstrap-treeview. The native method of this plug-in does not include the double-click event function. By default, the node of this plug-in is bound with a click event, which causes a conflict between the Click Event and the double-click event.
Write test code
Conflicting code:
Problem result display:
Each double-click event triggers two click events.
Conflict resolution code:
Problem solving result display:
Perfectly solves the conflict between click events and double-click events
Here we mainly use the functions in two HTMLDOMWindow objects, settimeout () and clearTimeout ()
The interval between the two click events is set to 300 milliseconds, depending on the actual situation.
The source code is as follows:
<! DOCTYPE html>
The preceding figure shows the jquery click and double-click event conflict solution, which is helpful for your learning.
Articles you may be interested in:
- Found a solution to conflicts between jQuery and Prototype
- How to resolve conflicts between jQuery and other libraries
- Solution to $ conflict after jQuery is loaded
- Solution to the $ conflict between jquery and velocity variables in the html file
- Comparison between jQuery's method to avoid conflict between $ operator and other JS Libraries
- Jquery plug-in conflict (jquery. noconflict) Solution
- Click and double-click the event conflict handling sample code
- Click the left mouse button to solve the conflict (to prevent bubbles)
- Effective Solution to jquery version conflicts