javascript - Zooming on hover -
i have image color overlay , want add zooming on image when user hover on image.
i'm trying achieve without jquery result don't mind using jquery.
thanks in advance
html:
<div class="rss-output"> <div class="body"> <a target="_blank" href="#"> <div class="overlay-feed"></div> <div class="imagefix zooming" style="float:none;"> <img src="http://www.gettyimages.co.uk/cms/staticcontent/1391099215267_hero2.jpg" alt="" height="337" width="600"/></a> </div> </div> </div>
css:
div.rss-output { float: left; width: 33.333%; position: relative; padding: 15px !important; overflow: hidden; } .rss-output .body { width: 100%; position: relative; } .rss-output .overlay-feed { background: #000 none repeat scroll 0% 0%; z-index: 2; position: absolute; width: 100%; height: 200px; opacity: 0.5; } div.imagefix { height: 200px; line-height: 250px; overflow: hidden; text-align: center; width: 100%; } div.imagefix img { margin: -50%; }
the solution proposed ketan good, add animation, make zoom smoother:
for example:
transition: 1s cubic-bezier(0.23,1,0.32,1);
see updated fiddle (forked ketan's one): http://jsfiddle.net/alessiozuccotti/84n3hu6v/2/
or change timing function prefer. link may you: http://www.w3schools.com/cssref/css3_pr_animation-timing-function.asp
Comments
Post a Comment