i am trying to make a responsive rollover using Jquery and Bootstrap3, but here is the catch the images must be responsive and it has to be IE7+ compatible, so thats why i'm not using or CSS3 background
Im stuck because everithing i tryied so far is failing on some point (background images are not responsive, IE is not compatible with canvas, position absolute needs a fixed width / Height, etc) can someboy help me? here is what i have been able to make so far...
HTML:
<div class="row">
<div class="col-sm-8">
<ul>
<li>
<div class="img-swap2">
<img class="animado img-responsive" src="http://dummyimage.com/125x66/000/fff" alt="" />
<img class="animado img-responsive" src="http://dummyimage.com/125x66/fff/000" alt="" />
</div>
</li>
<li>
<div class="img-swap2">
<img class="animado img-responsive" src="http://dummyimage.com/125x66/000/fff" alt="" />
<img class="animado img-responsive" src="http://dummyimage.com/125x66/fff/000" alt="" />
</div>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="img-swap2">
<img class="animado img-responsive" src="http://dummyimage.com/125x66/000/fff" alt="" />
<img class="animado img-responsive" src="http://dummyimage.com/125x66/fff/000" alt="" />
</div>
<div class="img-swap2">
<img class="animado img-responsive" src="http://dummyimage.com/125x66/000/fff" alt="" />
<img class="animado img-responsive" src="http://dummyimage.com/125x66/fff/000" alt="" />
</div>
</div>
</div>
JQuery:
$(document).ready(function(){
$('.img-swap2').hover(
function(){
$(this).children("img:eq(0)").fadeTo('400','0');
$(this).children("img:eq(1)").fadeTo('800','1');
},
function(){
$(this).children("img:eq(0)").fadeTo('800','1');
$(this).children("img:eq(1)").fadeTo('400','0');
});
});
CSS
ul {
list-style-type: none;
margin-bottom: 0;
}
ul li {
display: block;
float: left;
border-left: 1px solid #333;
width: 14%;
max-height: 63px;
}
.img-swap2 {
position: relative;
left: 0;
top: 0;
}
.img-swap2 img + img {
display: none;
position: absolute;
left: 0;
top: 0;
}
As you can see.. in the UL it works fine, but on the row the hover image shows wrong, right now im using a fixed size but in the final application im going to have several image sizes
Thnks!