Jquery Click Event and double-click event conflict solution, jquery Solution

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.