【发布时间】:2017-04-13 17:32:13
【问题描述】:
我有一个方形图像,它通过使用边框半径变成一个圆形:50%;到目前为止效果很好。 ;) 但是下一步很难做到:我希望图像通过使用 transform: scale 缩放“更近”。我的意思是:我不想改变图像的相同大小,它应该保持相同的直径。但我想显示图像的一小部分。缩放应该在 :hover 上激活,并且应该在 0.8s 的时间内处理
我的代码在 Firefox 中完美运行,但在 Chrome 和 Safari 中却不行。我的错误在哪里?
我的 HTML:
<div class="hopp_circle_img">
<img src="... alt="" />
</div>
我的 CSS:
.hopp_circle_img {
width: 100% !important;
height: 100% !important;
max-width: 100% !important;
max-height: 100% !important;
overflow: hidden;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
}
.hopp_circle_img img {
transition: all 0.8s;
-moz-transition: all 0.8s;
-webkit-transition: all 0.8s;
-o-transition: all 0.8s;
-ms-transition: all 0.8s;
}
.hopp_circle_img img:hover {
display: block;
z-index: 100;
transform: scale(1.25);
-moz-transform: scale(1.25);
-webkit-transform: scale(1.25);
-o-transform: scale(1.25);
-ms-transform: scale(1.25);
}
问题:
1)Chrome:“缩放”有效,但在过渡时间(o,8s)期间,图像有方形边框。过渡发生后,它们是圆形的。
2) 野生动物园: 过渡时间被忽略,过渡立即发生,没有“软”缩放。
3) IE:我不敢看 IE,如果它在 Safari 和 Chrome 中都不起作用。 ;)
感谢您的想法。我尝试了很多不同的东西,但都没有奏效。 拉斐尔
【问题讨论】:
-
对于您的第一个问题,可以在这里找到答案 - stackoverflow.com/questions/31693219/…
-
谢谢,但是我该如何解决这个问题?我还尝试在圆圈上放置一个带有图像的图层,以便在圆圈生长时对其进行遮盖。问题是,面具停止了:悬停。所以它或多或少没用。
-
该答案的 What is the solution? 部分以及 LGSon 在此处提供的答案中都有。他们不帮你解决第一个问题吗?
-
@Harry +1 为您的
border-radius修复