用于显示平台的团队成员。当您将鼠标悬停在团队成员的图像上时,我想显示和隐藏社交媒体图标。我正在使用CSS属性转换和缩放来完成此任务。
在这里,您可以看到我的代码:https://jsfiddle.net/johna/L9hbtqce。 (我也使用Bootstrap作为CSS框架和Font Awesome用于图标。)
HTML
<div class="team-member text-center">
<div class="picture">
<img src="http://s22.postimg.org/hxl9mdjqp/member.png" class="img-responsive" alt="Ward"/>
<div class="mask">
<div class="team-member-icons">
<a target="_blank" href="#">
<i class="fa fa-facebook"></i>
</a>
<a target="_blank" href="#">
<i class="fa fa-twitter"></i>
</a>
</div>
</div>
</div>
CSS
.team-member .picture {
background-color: #f2f2f2;
border: 7px solid #dedede;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
position: relative;
width: 225px;
height: 225px;
margin: 0 auto;
border-radius: 50%;
}
.team-member .picture:hover img {
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
-webkit-transform: scale(0);
transform: scale(0);
}
.team-member .picture:hover .mask {
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
opacity: 1;
}
.team-member .picture:hover .mask .team-member-icons {
-webkit-transition: all 0.8s ease-in-out;
-moz-transition: all 0.8s ease-in-out;
-o-transition: all 0.8s ease-in-out;
-ms-transition: all 0.8s ease-in-out;
transition: all 0.8s ease-in-out;
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
-webkit-transform: scale(1);
transform: scale(1);
}
.team-member .picture img {
margin: 0 auto;
-webkit-transition: all 0.8s ease-in-out;
-moz-transition: all 0.8s ease-in-out;
-o-transition: all 0.8s ease-in-out;
-ms-transition: all 0.8s ease-in-out;
transition: all 0.8s ease-in-out;
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
-webkit-transform: scale(1);
transform: scale(1);
}
.team-member .picture .mask {
-webkit-transition: all 0.8s ease-in-out;
-moz-transition: all 0.8s ease-in-out;
-o-transition: all 0.8s ease-in-out;
-ms-transition: all 0.8s ease-in-out;
transition: all 0.8s ease-in-out;
opacity: 0;
position: absolute;
top: 0;
border-radius: 50%;
width: 100%;
height: 100%;
}
.team-member .picture .mask .team-member-icons {
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
-webkit-transform: scale(0);
transform: scale(0);
display: table;
margin: 90px auto;
}
.team-member .picture .mask .team-member-icons a {
background-color: #a5a5a5;
border-radius: 50%;
display: block;
float: left;
height: 34px;
line-height: 32px;
margin: 0 5px;
width: 34px;
}
.team-member .picture .mask .team-member-icons a i {
color: #fff;
}
在Chrome或Firefox上一切正常,但在Internet Explorer(IE11)上,当您使用社交媒体图标“取消”圈子时,图像会闪烁。
答案 0 :(得分:2)
修复了我在Internet Explorer上的问题:https://jsfiddle.net/L9hbtqce/15/。我在图像上添加了1的不透明度,当您将鼠标悬停在图像上时,不透明度为0。
.team-member .picture {
background-color: #f2f2f2;
border: 7px solid #dedede;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
position: relative;
width: 225px;
height: 225px;
margin: 0 auto;
border-radius: 50%;
}
.team-member .picture:hover img {
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
-webkit-transform: scale(0);
transform: scale(0);
opacity: 0;
}
.team-member .picture:hover .mask {
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
opacity: 1;
}
.team-member .picture:hover .mask .team-member-icons {
-webkit-transition: all 0.8s ease-in-out;
-moz-transition: all 0.8s ease-in-out;
-o-transition: all 0.8s ease-in-out;
-ms-transition: all 0.8s ease-in-out;
transition: all 0.8s ease-in-out;
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
-webkit-transform: scale(1);
transform: scale(1);
}
.team-member .picture img {
margin: 0 auto;
width: 100%;
height: 100%;
-ms-transition: 1s;
transition: 1s;
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.team-member .picture .mask {
-webkit-transition: all 0.8s ease-in-out;
-moz-transition: all 0.8s ease-in-out;
-o-transition: all 0.8s ease-in-out;
-ms-transition: all 0.8s ease-in-out;
transition: all 0.8s ease-in-out;
opacity: 0;
position: absolute;
top: 0;
border-radius: 50%;
width: 100%;
height: 100%;
}
.team-member .picture .mask .team-member-icons {
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
-webkit-transform: scale(0);
transform: scale(0);
display: table;
margin: 90px auto;
}
.team-member .picture .mask .team-member-icons a {
background-color: #a5a5a5;
border-radius: 50%;
display: block;
float: left;
height: 34px;
line-height: 32px;
margin: 0 5px;
width: 34px;
}
.team-member .picture .mask .team-member-icons a i {
color: #fff;
}