No worries, the only way I have gotten it to work is rather complex.
This is line 45-56 from the final code on my blog:
$(‘input[type=radio]’).each(function(){
var radio = $(this);
var label = radio.prev(‘label’);
if(radio.is(’:checked’)){
$(label).css(‘background-color’, ‘#f00’).
css(‘box-shadow’, ‘inset 0px 0px 0px 4px #fff’);
} else {
$(label).css(‘background-color’, ‘#fff’).
css(‘box-shadow’, ‘none’);
}
});
Now add the following lines:
$(‘input[type=radio]’).each(function(){
var radio = $(this);
var label = radio.prev(‘label’);
label.on(‘mouseenter’, function() {
if(radio.is(’:checked’)){
$(label).css(‘background-color’, ‘#00f’).
css(‘box-shadow’, ‘inset 0px 0px 0px 4px #fff’);
} else {
$(label).css(‘background-color’, ‘#00f’).
css(‘box-shadow’, ‘none’);
}
});
label.on(‘mouseleave’, function() {
if(radio.is(’:checked’)){
$(label).css(‘background-color’, ‘#f00’).
css(‘box-shadow’, ‘inset 0px 0px 0px 4px #fff’);
} else {
$(label).css(‘background-color’, ‘#fff’).
css(‘box-shadow’, ‘none’);
}
});
if(radio.is(’:checked’)){
$(label).css(‘background-color’, ‘#f00’).
css(‘box-shadow’, ‘inset 0px 0px 0px 4px #fff’);
} else {
$(label).css(‘background-color’, ‘#fff’).
css(‘box-shadow’, ‘none’);
}
});
The “mouseenter” part gives you the ability to define different hover styles for selected and unselected radio buttons. In the “mouseleave” part, you should switch back to the original styling.
I have put an example online: http://ku6ff2.axshare.com/#c=2
It may be possible to also use :hover for the CSS selector, but so far I haven’t found the right way to do so.