I have mark up that toggles the hover css style using this rule. When there’s a checkbox inside the panel I want to remove the background image style. Is this possible? I’ve tried the following although it fails.
CSS:
.StaffMode .day ul li.standard a:hover table {
background:url("test.png");
}
JS:
$("li.test table li").hover(
function () {
if($(this).children(':checked')) {
alert('need to remove the background image style'); // shows as expected
$(this).children('a').removeClass('hover'); // this doesnt work?
}
}
);
What you need to do is put some restriction on your
:hoverrule, and have your JavaScript change the element so it no longer applies. Something like this:And then your JavaScript does this:
You can’t remove the
:hoverbut you can remove thehas-hoverclass, and since the rule requires both, this will prevent the.has-hover:hoverrule from being applied.