Can I suggest an alternative approach?
How about simply assigning a background-color
to all child elements of the page, and then, on hover()
, adjust the background-color
of that element to increase its contrast?
$('html').children().css('background-color','rgba(0,0,0,0.2)');
$('body').children().hover(
function(){
$(this).css('background-color','#fff');
},
function(){
$(this).css('background-color','rgba(0,0,0,0.2)');
});
JS Fiddle demo.