html - Zoom in image inside fluid grid -
i using isotope plugin fluid grid , add effects images on hover, in grid has 3 different images different height: jsfiddle code. there way keep them responsive , fix heigh change on hover zoom? please suggest, has been done wrong?
html
<div class="item"> <a href="https://twitter.com/"> <img src="http://s9.postimg.org/n0sl7ucqn/image.jpg" alt=""> </a> </div> <div class="item"> <a href="https://twitter.com/"> <img src="http://s17.postimg.org/6r28okkq7/image.jpg" alt=""> </a> </div> <div class="item"> <a href="https://twitter.com/"> <img src="http://s17.postimg.org/c12m24flb/image.jpg" alt=""> </a> </div>
css
.item { width: 46.1%; height: auto; margin-right: 4%; margin-bottom: 30px; float: left; overflow: hidden; } #social_indicator { font-size: 14px; font-weight: 300; font-style: italic; text-align: right; margin-top: 0; margin-bottom: 0; } .item img { width: 100%; height: 100%; -webkit-transition: 3s ease; -moz-transition: 3s ease; -o-transition: 3s ease; -ms-transition: 3s ease; transition: 3s ease; } .item img:hover { width: 105%; height: 105%; margin-right: 1%; margin-bottom: 1%; } }
first, overflow:hidden;
should on div, not image.
i set height of div jquery prevent scaling, when image does:
$('.item > > img').each(function(index, value){ $(value).parent('a').parent('.item').height( $(value).height() ); });
remember add jquery-library in <head>
:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
Comments
Post a Comment