search

Home  >  Q&A  >  body text

javascript - Add a pseudo-class to a certain class. This class has a click event. Now when I click on the pseudo-class, the click event is also triggered.

Add a pseudo-class to a certain class. This class has a click event. Now when I click on the pseudo-class, the click event is also triggered. How can I prevent the click event from being triggered by clicking on the pseudo-class?

欧阳克欧阳克2728 days ago1057

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-07-05 10:46:13

    Disable mouse click events:

    Add to the style of the pseudo class:

    pointer-events:none;
    

    Compatibility: here

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-07-05 10:46:13

    Detailed explanation of pointer-events:none;
    http://www.zhangxinxu.com/wor...
    currentTarget handles click events and is also effective in event capture

    reply
    0
  • Cancelreply