search

Home  >  Q&A  >  body text

javascript - How to cancel and restore hover events in jquery

How to cancel and restore hover events in jquery.
Can hover written in css be canceled and restored?

女神的闺蜜爱上我女神的闺蜜爱上我2793 days ago1200

reply all(4)I'll reply

  • 天蓬老师

    天蓬老师2017-06-14 10:55:46

    hover is a simple version of mouseenter mouseleave, you can just write like this
    $("td").bind("mouseenter mouseleave",handlerInOut);

    $("td").unbind("mouseenter mouseleave",handlerInOut);

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-14 10:55:46

    Let’s talk about canceling and restoring hover in CSS, it’s actually very simple

    For example, corresponding to a p, you can write the hover effect in CSS and define it on a class, and then add this class to p through jquery to achieve the hover effect. If you want to cancel, then directly add this Just remove the class.

    Examples are as follows:

    http://runjs.cn/detail/ez5qogoo

    reply
    0
  • 代言

    代言2017-06-14 10:55:46

    jquery doesn’t seem to be able to select pseudo classes, right?

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-06-14 10:55:46

    $(this).addClass("focus").css("pointer-events","none");

    I found the answer. It can also be done by adding a pointer-events event. I think this is the simplest

    reply
    0
  • Cancelreply