I am trying to add a highlight color to a class like this
$(".common_box").hover(function(){
$(".common_box").addClass("hover_me");
});
This works but why doesnt this
$(".common_box").hover(function(){
$(".common_box").toggleClass("hover_me");
});
When i hover over this nothing happens
Is there no unhover to put to remove the class hover_me when they move away from the hover
There’s currently a bug in some situations where the mouse enter/leave events are firing twice, so it is working, but it’s double toggling each in/out, so no net effect…for now, to be safe:
This is a bug (I believe) because of the
.live()changes to support.hover(), which is causing some unwanted side-effects, you can be explicit like above to be 100% safe, so if each handler runs multiple times, at least for your purposes, it’s alright.