Please, considere this CSS code:
a { color: #ffcc00; }
a:hover { color: #ccff00; }
This HTML code:
<a href="#" id="link">Link</a>
<button id="btn">Click here</button>
And, finally, this JS code:
$("#btn").click(function() {
$("#link").trigger("hover");
});
I would like to make my link uses its pseudo-class :hover when the button is clicked.
I tried to trigger events like mousemove, mouseenter, hover etc, but anyone works.
Notice that I want to force the use of the my CSS pseudo-class :hover specification and not use something like:
$("#link").css("color", "ccff00");
Some one know how do I do this? Thank you a lot.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…