gpt4 book ai didi

html - 溢出:隐藏影响缩放图像

转载 作者:行者123 更新时间:2023-11-28 06:30:05 26 4
gpt4 key购买 nike

我正在创建一个 slider ,其中 .slider-wrap是具有规则 overflow: hidden; 的父 div我希望每当我将鼠标悬停在 div 上时,我的每张image 都应该放大 slider-boxes在我使用 overflow: hidden; 之前一切正常但是当我开始使用 overflow: hidden;在我未使用 overflow: hidden;Snippet 2 中,图像不会缩小为 Desired Result

我想要我的最终结果,如 Snippet 2

但我认为 overflow 的使用很重要,因为当我将其动态化时会有更多图像出现,所以有什么方法可以解决这个问题。

这是 jsfiddle https://jsfiddle.net/rhulkashyap/7g3vypqh/

片段 1:我正在获取

body{
background-color: #DD3735;
padding-top:30px;
}
.slider-wrap{
width:616px;
height:120px;
border:1px solid #ccc;
margin:0 auto;
box-shadow: 0 0 10px #000;
border-radius:5px;
overflow:hidden;
}
img, .slider-boxes{
width:120px;
height:120px;
}
.slider-boxes{
display: inline-block;
-webkit-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.slider-boxes:hover{
-webkit-transform: scale(1.30);
transform: scale(1.30);
box-shadow: 0 0 10px #000;
}
<div class="slider-wrap">
<div class="slider-boxes"><img src="https://pbs.twimg.com/profile_images/378800000108340114/a586d7a8df39836a114651aef74cd2d0_400x400.jpeg" alt="Image1"></div>
<div class="slider-boxes"><img src="https://s-media-cache-ak0.pinimg.com/736x/77/06/4e/77064e4e9ccc289ee5394dd7dbf48011.jpg" alt="Image2"></div>
<div class="slider-boxes"><img src="http://gloimg.gearbest.com/gb/2014/201411/goods-img/1415993980392-P-2179386.jpg" alt="Image3"></div>
<div class="slider-boxes"><img src="https://pbs.twimg.com/profile_images/378800000451012500/4628fbb9dc70514d389ed9491243866f_400x400.png" alt="Image4"></div>
<div class="slider-boxes"><img src="http://howtodrawdat.com/wp-content/uploads/2014/01/1st-pic-Dave-Minion-from-despicable-me.png" alt="Image5"></div>
</div>

片段 2:期望的结果

body{
background-color: #DD3735;
padding-top:30px;
}
.slider-wrap{
width:616px;
height:120px;
border:1px solid #ccc;
margin:0 auto;
box-shadow: 0 0 10px #000;
border-radius:5px;
}
img, .slider-boxes{
width:120px;
height:120px;
}
.slider-boxes{
display: inline-block;
-webkit-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.slider-boxes:hover{
-webkit-transform: scale(1.30);
transform: scale(1.30);
box-shadow: 0 0 10px #000;
}
<div class="slider-wrap">
<div class="slider-boxes"><img src="https://pbs.twimg.com/profile_images/378800000108340114/a586d7a8df39836a114651aef74cd2d0_400x400.jpeg" alt="Image1"></div>
<div class="slider-boxes"><img src="https://s-media-cache-ak0.pinimg.com/736x/77/06/4e/77064e4e9ccc289ee5394dd7dbf48011.jpg" alt="Image2"></div>
<div class="slider-boxes"><img src="http://gloimg.gearbest.com/gb/2014/201411/goods-img/1415993980392-P-2179386.jpg" alt="Image3"></div>
<div class="slider-boxes"><img src="https://pbs.twimg.com/profile_images/378800000451012500/4628fbb9dc70514d389ed9491243866f_400x400.png" alt="Image4"></div>
<div class="slider-boxes"><img src="http://howtodrawdat.com/wp-content/uploads/2014/01/1st-pic-Dave-Minion-from-despicable-me.png" alt="Image5"></div>
</div>

最佳答案

这不是最漂亮的解决方案,但它确实解决了一些问题..

添加一个

.sliding-wrap:hover
{
overflow: visible;
}

有诀窍,但它并没有使缓和变得非常漂亮..

Fiddle

关于html - 溢出:隐藏影响缩放图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35030815/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com