html - Zoom Effect using css but the size of the div should be fixed -
edit: if don't know width size ?
please go above link. want zoom effect take place without div zooming on. image should zoom inside div.`i don't know going wrong. can ?
.img-container { position: relative; overflow: hidden; margin:0; padding:0; height: 100px !important; } .img-container img{ height: 100px; -moz-transition:all .8s;-webkit-transition:all .8s;transition:all .8s } .img-container:hover img{ max-width:100% -moz-transform: scale(1.4); -webkit-transform: scale(1.4); transform: scale(1.4); }
<div class="container"> <div class="row"> <div class="col-sm-4"> <div class="img-container"> <img src="http://www.macforensicslab.com/images/icon_googlesearch.jpg"/> </div> </div> <div class="col-sm-4"> <div class="img-container"> <img src="http://www.macforensicslab.com/images/icon_googlesearch.jpg"/> </div> </div> <div class="col-sm-4"> <div class="img-container"> <img src="http://www.macforensicslab.com/images/icon_googlesearch.jpg"/> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="img-container"> <img src="http://www.macforensicslab.com/images/icon_googlesearch.jpg"/> </div> </div> </div> </div>
you need set width img-container able "count" apply overflow:hidden;
from.
fiddle: https://jsfiddle.net/59ay7x22/1/
edit based on comment:
you can apply zoom effect on first element this:
.img-container { position: relative; overflow: hidden; margin:0; padding:0; height: 100px !important; width: 100px; } .img-container img{ height: 100px; -moz-transition:all .8s;-webkit-transition:all .8s;transition:all .8s } .col-sm-4:first-child .img-container:hover img{ max-width:100% -moz-transform: scale(1.4); -webkit-transform: scale(1.4); transform: scale(1.4); }
<div class="container"> <div class="row"> <div class="col-sm-4"> <div class="img-container"> <img src="http://www.macforensicslab.com/images/icon_googlesearch.jpg"/> </div> </div> <div class="col-sm-4"> <div class="img-container"> <img src="http://www.macforensicslab.com/images/icon_googlesearch.jpg"/> </div> </div> <div class="col-sm-4"> <div class="img-container"> <img src="http://www.macforensicslab.com/images/icon_googlesearch.jpg"/> </div> </div> <div class="col-sm-4"> <div class="img-container"> <img src="http://www.macforensicslab.com/images/icon_googlesearch.jpg"/> </div> </div> </div> </div>
Comments
Post a Comment