I have a div. In my CSS, I added ':before' to this div for create an other color block over it.
In jquery, I want to change the color on the mouseover but only for the "div:before" block, but it doesn't work.
How can I solve my problem ?
Thks
My CSS :
div {
background:cyan;
width:200px;
height:300px;
}
div.color:before {
content:'Color me !';
background:orange;
width:100px;
height:100px;
display:inline-block;
position:absolute;
}
My jQuery :
$('div').addClass('color');
$("div").toggleClass("color").mouseover(function() {
$(this).stop().css({ 'background':'#FF0000' });
});
$("div").toggleClass("color").mouseout(function() {
$(this).stop().css({ 'background':'#FFFF00' });
});