Home  >  Article  >  Web Front-end  >  Solution to the problem of mouse left click conflict (preventing bubbling)_javascript skills

Solution to the problem of mouse left click conflict (preventing bubbling)_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:48:211404browse

I have implemented two right-click menus on one page. When the left button of the mouse clicks on a blank space, the right-click menu is not hidden. So, Google finally found a way to change the left mouse click event to:

Copy the code The code is as follows:

$(document).click( function () {
}


is changed to
Copy the code The code is as follows:

$(document).on('click touchstart', function () {
}


Problem solved.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn