In my jQuery code (see below), I can't manage to change the color of the "typetravaux" class content.
The opacity change on hover is OK, but the color change does not work (I tried 2 different ways, but none of them is working).
Can you guys tell me what I am doing wrong ? Thanks !
CSS :
.typetravaux {
width: 100%;
color: #ffffff;
}
HTML:
<div class="solutions">
<div class="bloc1">
<span class="typetravaux">PLOMBERIE</span>
<div class="picture"><img src="img/plomberie.png" class="prestapicture"></div>
</div>
<div class="bloc2">
<span class="typetravaux">CHAUFFAGE</span>
<div class="picture"><img src="img/chauffage.jpg" class="prestapicture"></div>
</div>
<div class="bloc3">
<span class="typetravaux">CLIMATISATION</span>
<div class="picture"><img src="img/climatisation.jpg" class="prestapicture"></div>
</div>
</div>
jQuery :
$prestapicture = $('.prestapicture');
for (y=0; y < $prestapicture.length; y++) {
$prestapicture.eq(y).on("mouseover", function() {
$(this).css("opacity", "0.3");
$(this).prev(".typetravaux").css("color","black") // **does not work**
})
$prestapicture.eq(y).on("mouseout", function() {
$(this).css("opacity", "1");
$(".typetravaux").eq(y).css("color","white"); //**does not work either**
})
}