Setting CSS pseudo-class rules from JavaScript

后端 未结 13 1656
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 01:01

I\'m looking for a way to change the CSS rules for pseudo-class selectors (such as :link, :hover, etc.) from JavaScript.

So an analogue of the CSS code: a:hove

13条回答
  •  无人及你
    2020-11-22 01:56

    Switching stylesheets in and out is the way to do it. Here is a library to build stylesheets dynamically, so you can set styles on the fly:

    http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/

提交回复
热议问题