i want that the zoom-in will effect only the img inside the div and won't resize all the div scale
here is the fiddle link: http://jsfiddle.net/4tHWg/1/
example code:
.box {
float: left;
position: relative;
width: 14.285714286%;
}
.boxInner img {
width: 100%;
display: block;
-webkit-filter: grayscale(00%);
-moz-filter: grayscale(00%);
-o-filter: grayscale(00%);
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.boxInner img:hover {
width: 200%;
}
Simply hover your mouse over the image to enlarge it. Hover your mouse over any image on the supported websites and the extension will automatically enlarge the image to its full size, making sure that it still fits into the browser window.
Try moving your mouse over this box: It scales up exactly 1.5 times the original size — so it becomes 50% bigger when you move your mouse over (hover) it. The CSS transform property's scale method can either increase or decrease the size of elements.
The :hover selector is used to select elements when you mouse over them. Tip: The :hover selector can be used on all elements, not only on links. Tip: Use the :link selector to style links to unvisited pages, the :visited selector to style links to visited pages, and the :active selector to style the active link.
The zoom property in CSS allows you to scale your content. It is non-standard, and was originally implemented only in Internet Explorer. Although several other browsers now support zoom, it isn't recommended for production sites.
You can use css transforms:
http://jsfiddle.net/4tHWg/3/
.boxInner img:hover {
-webkit-transform: scale(1.4);
-moz-transform: scale(1.4);
-ms-transform: scale(1.4);
-o-transform: scale(1.4);
transform: scale(1.4);
}
1.4 equals 1.4 times its original size.
Adding on to hugo's answer, you should add this to your parent element.
.boxInner {
overflow: hidden;
}
.boxInner img:hover {
-webkit-transform: scale(1.4);
-moz-transform: scale(1.4);
-ms-transform: scale(1.4);
-o-transform: scale(1.4);
transform: scale(1.4);
}
This way the div won't resize together with the child image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With