How to get css hover values on click?

前端 未结 4 833
你的背包
你的背包 2021-01-28 12:08

Following up on this question, I have another issue - how to get css hover values when you click on a text link?

For instance, I have these values for the text hover

4条回答
  •  难免孤独
    2021-01-28 12:44

    HTML changes, adding an extra class:

    Click Me
    

    CSS changes, modify hover selector:

    a.test.apply-hover:hover { ...
    

    JS changes, remove 'apply-hover' class on click event:

    $(this).removeClass('apply-hover');
    

    Example: http://jsfiddle.net/bGKE7/1/

提交回复
热议问题