I have a div
that will contain in your hover a specific color, this color will depend on the a
that exists above it.
.homeNoticiasOpacidade {
width: 100%;
height: 100%;
background-image: url("../imagens/engenhariaPNG.png");
top: 0;
position: absolute;
z-index: 2;
background-repeat: repeat;
right: 0;
display: none;
}
.homeNoticias li:hover .homeNoticiasOpacidade {
display: block;
}
.homeNoticiasOpacidadeEngenharia {
background-image: url("../imagens/engenhariaPNG.png");
}
.homeNoticiasOpacidadeHospitalar {
background-image: url("../imagens/hospitalarPNG.png");
}
.homeNoticiasOpacidadeElevadores {
background-image: url("../imagens/elevadoresPNG.png");
}
.homeNoticiasOpacidadeIluminacao {
background-image: url("../imagens/IluminacaoPNG.png");
}
<ul class="homeNoticias margin-top-40">
<li>
<div class="p-relative">
<a href="/engenharia">
<div class="homeNoticiasOpacidade homeNoticiasOpacidadeEngenharia"></div>
<img src="./imagens/noticias1.jpg" height="305" width="250" alt="" title="" />
<div class="homeNoticiasFundo">
<span class="homeNoticiasData">03/09/2014</span>
<span class="homeNoticiasDescricao">Lorem ipsum dolor sit amet, meis omnes ei cum, solet.</span>
<div class="clear"></div>
<a href="#" class="flechaPreta flechaBranca p-absolute bottom-20"></a>
</div>
</a>
</div>
</li>
<li>
<div class="p-relative">
<a href="/hospitalar">
<div class="homeNoticiasOpacidade homeNoticiasOpacidadeEngenharia"></div>
<img src="./imagens/noticias1.jpg" height="305" width="250" alt="" title="" />
<div class="homeNoticiasFundo">
<span class="homeNoticiasData">03/09/2014</span>
<span class="homeNoticiasDescricao">Lorem ipsum dolor sit amet, meis omnes ei cum, solet.</span>
<div class="clear"></div>
<a href="#" class="flechaPreta flechaBranca p-absolute bottom-20"></a>
</div>
</a>
</div>
</li>
</ul>
What do I want to do?
When the user hover over the li
that has a
/ engineering he adds the homeNoticiasOpacidadeEngenharia
class to the homeNoticiasOpacidade
class. Or, if you have the / hospitalar it includes the homeNoticiasOpacidadeHospitalar
class How could I do this?
How much will (window.location.toString().indexOf('/engenharia') > 0)
work?