【问题标题】:CSS transition animation on hover not woking in Firefox悬停时的 CSS 过渡动画在 Firefox 中不起作用
【发布时间】:2016-04-13 21:37:04
【问题描述】:

我正在制作一个带有四个图标的菜单,该菜单会在屏幕右侧弹出。屏幕右侧显示一个箭头(east-exit-icon),如果您将鼠标悬停在它上面,它会显示其他四个图标(communicate-icon) 这适用于除 FireFox 之外的所有浏览器。 有谁可以解决这个问题?

html {
  width: 100%;
  height: 100%;
  position: absolute;
  overflow: hidden;
  font-family: 'Roboto', sans-serif;
}

#east-exit {
  display: flex;
  opacity: 1;
  z-index: -1;
  align-items: stretch;
  justify-content: space-around;
  flex-direction: column;
  position: absolute;
  right: 0;
  height: 100%;
  width: 85px;
  font-size: 55px;
}

.east-exit-icon {
  -webkit-transition: all .2s ease;
  -moz-transition: all .2s ease;
  -o-transition: all .2s ease;
  -ms-transition: all .2s ease;
  transition: all .2s ease;
  font-size: 45px;
  opacity: 0.1;
}

#east-exit:hover .east-exit-icon { opacity: 0; }

.communicate-icon {
  z-index: 1;
  -webkit-transition: all .3s ease;
  -moz-transition: all .3s ease;
  -o-transition: all .3s ease;
  -ms-transition: all .3s ease;
  transition: all .3s ease;
  color: darkgrey;
  opacity: 0;
}

#east-exit:hover .communicate-icon { opacity: 1; }

.communicate-icon:hover,
.communicate-icon:focus,
.communicate-icon:active {
  -webkit-transform: scale(1.2);
  transform: scale(1.2);
  -webkit-transition-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);
  transition-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);
  color: grey;
  cursor: pointer;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet"/>

<div id="east-exit">
  <a><i class="communicate-icon fa fa-envelope"></i></a>
  <a><i class="communicate-icon fa fa-comments"></i></a>
  <i class="east-exit-icon fa fa-arrow-right"></i>
  <a><i class="communicate-icon fa fa-phone"></i></a>
  <a><i class="communicate-icon fa fa-camera"></i></a>
</div>

编辑:https://jsfiddle.net/grhajrbp/

【问题讨论】:

  • 你也可以提供一个带有html代码的jsfiddle吗?
  • 是的,很抱歉我不得不放弃一些代码才能让小提琴正常工作。 jsfiddle.net/grhajrbp

标签: css


【解决方案1】:

只需在 #east-exit

上删除您的 z-index: -1;

html {
  width: 100%;
  height: 100%;
  position: absolute;
  overflow: hidden;
  font-family: 'Roboto', sans-serif;
}

#east-exit {
  display: flex;
  opacity: 1;
  align-items: stretch;
  justify-content: space-around;
  flex-direction: column;
  position: absolute;
  right: 0;
  height: 100%;
  width: 85px;
  font-size: 55px;
}

.east-exit-icon {
  -webkit-transition: all .2s ease;
  -moz-transition: all .2s ease;
  -o-transition: all .2s ease;
  -ms-transition: all .2s ease;
  transition: all .2s ease;
  font-size: 45px;
  opacity: 0.1;
}

#east-exit:hover .east-exit-icon { opacity: 0; }

.communicate-icon {
  z-index: 1;
  -webkit-transition: all .3s ease;
  -moz-transition: all .3s ease;
  -o-transition: all .3s ease;
  -ms-transition: all .3s ease;
  transition: all .3s ease;
  color: darkgrey;
  opacity: 0;
}

#east-exit:hover .communicate-icon { opacity: 1; }

.communicate-icon:hover,
.communicate-icon:focus,
.communicate-icon:active {
  -webkit-transform: scale(1.2);
  transform: scale(1.2);
  -webkit-transition-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);
  transition-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);
  color: grey;
  cursor: pointer;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet"/>

<div id="east-exit">
  <a><i class="communicate-icon fa fa-envelope"></i></a>
  <a><i class="communicate-icon fa fa-comments"></i></a>
  <i class="east-exit-icon fa fa-arrow-right"></i>
  <a><i class="communicate-icon fa fa-phone"></i></a>
  <a><i class="communicate-icon fa fa-camera"></i></a>
</div>

【讨论】:

  • 谢谢!这怎么不影响其他浏览器?
  • 这是个好问题,我的朋友。不幸的是,我不知道确切的原因。
猜你喜欢
  • 2014-12-15
  • 2020-04-21
  • 1970-01-01
  • 2018-09-04
  • 1970-01-01
  • 2012-01-24
  • 2011-09-12
  • 2020-10-14
  • 1970-01-01
相关资源
最近更新 更多