I have four div elements and on mouseover the selected div will get zoomed. But i need to get the mouseover event of the remaining three underlayed divs even when the other one is overlayed, so that i can make the earlier one out of zoom and the currently hovered one zoomed.
Please consider my fiddle: http://jsfiddle.net/aniprasanth/7jFGH/1/
HTML code goes like this
<div id="main_window">
<div class="multi-window">
<div class="zoomer tile">
<img src="images/img1.jpg" width="207" height="138" />
</div>
</div>
<div class="multi-window">
<div class="zoomer tile">
<img src="images/img2.jpg" width="207" height="138" />
</div>
</div>
<div class="multi-window">
<div class="zoomer tile">
<img src="images/img3.jpg" width="207" height="138" />
</div>
</div>
<div class="multi-window">
<div class="zoomer tile">
<img src="images/img4.jpg" width="207" height="138" />
</div>
</div>
</div>
CSS Goes like this:
#main_right #main_window {
height: 320px;
width: 460px;
margin-right: auto;
margin-left: auto;
margin-top: 20px;
position: relative;
}
.multi-window {
height: 150px;
width: 218px;
float: left;
margin-right: 11px;
margin-bottom: 10px;
cursor: pointer;
}
.zoomer {
height: 140px;
width: 208px;
cursor:pointer;
}
.zoom {
height: 301px;
width: 450px;
float:none;
margin:0px;
cursor:pointer;
position:absolute;
left:0;
top:0;
background-color:#FFF;
}
.multi-window img {
width:100% !important;
height:100% !important;
}
and finally the script:
$('.zoomer').on('mouseenter',function(e){
$(this).addClass('zoom').removeClass('zoomer');
$('.zoom img').css({
'width':'100%',
'height':'100%'
});
$(this).bind('mouseleave click', function(){
$(this).removeClass('zoom').addClass('zoomer');
$('.zoomer').removeClass('zoomer');
});
});