J'ai eu un problème similaire - je veux remplacer l'image au moment du :hover mais je ne peux pas utiliser BACKGRUND-IMAGE en raison de l'absence de la conception adaptative de Bootstrap.
Si, comme moi, vous voulez seulement changer l'image au :hover (sans insister sur le changement de SRC pour la balise image en question), vous pouvez faire quelque chose comme ceci - c'est une solution uniquement en CSS.
HTML :
<li>
<img src="/picts/doctors/SmallGray/Zharkova_smallgrey.jpg">
<img class="hoverPhoto" src="/picts/doctors/Small/Zharkova_small.jpg">
</li>
CSS :
li { position: relative; overflow: hidden; }
li img.hoverPhoto {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
opacity: 0;
}
li.hover img { /* it's optional - for nicer transition effect */
opacity: 0;
-web-kit-transition: opacity 1s ease;
-moz-transition: opacity 1s ease;li
-o-transition: opacity 1s ease;
transition: opacity 1s ease;
}
li.hover img.hoverPhoto { opacity: 1; }
Si vous voulez un code compatible avec IE7, vous pouvez masquer/afficher l'image :HOVER par son positionnement et non par son opacité.