html - Thumbnail grid image resize issue -
so i'm trying create portfolio hover text. tried make little responsive bootstrap, can't right how image centered in div when scaling down.
i wanna ( https://www.weblounge.be/en/ )
with high of 100% , width of 100% show full size of image when resizing.
i guess wrong can't find issue.
my buildup
<div class="col-lg-4 col-sm-6 nopad"> <div class="box"> <img src="http://i.imgur.com/duutnax.jpg"> <div class="overlay"> <h5>random website</h5> <p class="text">random text</p> </div> </div> </div>
and css
.container { background-color: #fff; padding: 100px 0px 100px 0px; .nopad { padding-left: 0px; padding-right: 0px; } .box { cursor: pointer; height: 400px; position: relative; overflow: hidden; width: 100%; text-align: left; img { position: absolute; width: 100%; -webkit-transition: 300ms ease-out; -moz-transition: 300ms ease-out; -o-transition: 300ms ease-out; -ms-transition: 300ms ease-out; transition: 300ms ease-out; } .overlay { background: rgba(0, 0, 0, 0.7); position: absolute; left: 0; z-index: 100; opacity: 0; width: 100%; height: 100%; box-sizing: border-box; text-align: center; padding-top: 20%; -webkit-transition: 300ms ease-out; -moz-transition: 300ms ease-out; -o-transition: 300ms ease-out; -ms-transition: 300ms ease-out; transition: 300ms ease-out; h5 { color:#fff; opacity: 0; transition-delay: 0.1s; transition-duration: 0.2s; transform: translatey(60px); -webkit-transform: translatey(60px); } p { color: #fff; opacity: 0; transition-delay: 0.2s; transition-duration: 0.2s; transform: translatey(60x); -webkit-transform: translatey(60px); } .button-white { opacity: 0; transition-delay: 0.2s; transition-duration: 0.2s; transform: translatey(60px); -webkit-transform: translatey(60px); margin: 0px; } } &:hover img { -webkit-transform: scale(1.05); -moz-transform: scale(1.05); -ms-transform: scale(1.05); -o-transform: scale(1.05); transform: scale(1.05); } &:hover .overlay { opacity: 1; h5 { opacity: 1; transform: translatex(0px); -webkit-transform: translatex(0px); } p { opacity: 1; transform: translatex(0px); -webkit-transform: translatex(0px); } } } }
my codepen show wrong: http://codepen.io/denniswegereef/pen/mwjxde
you need use product images background-image in product div:
<div class="box"> <div class="product-image" style="background-image: url(http://i.imgur.com/duutnax.jpg)"></div> ... </div>
and change css .box img
, .box .product-image
:
.box { .product-image { position: absolute; width: 100%; height:100%; -webkit-transition: 300ms ease-out; transition: 300ms ease-out; background-repeat: no-repeat; background-size: cover; } &:hover .product-image { -webkit-transform: scale(1.05); transform: scale(1.05); } }
Comments
Post a Comment