[Solved] jQuery reuse of CSS-hover? [closed]


1) a event that activate and deactivate the CSS houver; 2) a complex
selector logic.

In both examples mentioned above, you STILL CAN use CSS classes. Simply perform a toggleClass using jQuery for a specially-defined class that overrides the default hover functionality.

Example, you have this:

.myElement {
    color: green;
}
.myElement:hover {
    color: red;
}

Simply add this class:

.myElement.disabled {
    color: green;
}

Call .toggleClass('disabled') or .addClass('disabled') on any element that fails your logic or triggers your event.

See http://jsfiddle.net/samliew/NMmLN

2

solved jQuery reuse of CSS-hover? [closed]