CSS3 transition/hover effect not working in Firefox; a Firefox bug?

被刻印的时光 ゝ 提交于 2019-12-17 20:25:43

问题


I'm trying to create a mouse-over effect that slides the top layer to the left and reveal the bottom layer using CSS3. The code works in Chrome but not in Firefox...did I do something stupid again? Thanks for your help!

Edit: I must have done something wrong, because even if I leave out the transition code, nothing happens when I hover over "layers" in Firefox...:(

The code:

<html>
  <div class="layers">
    <div class="over">content</div>
    <div class="under">content</div>
  </div>
</html>

The style:

.layers {
  position: relative;   
  width: 200px;
  height: 50px;
  overflow: hidden;
}   

.over {
  width: 200px;
  height: 50px;
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 1;
  -webkit-transition: all 1s ease-in-out;
  -moz-transition: all 1s ease-in-out;
  transition: all 1s ease-in-out;
}   
.under {
  width: 200px;
  height: 50px;
  position: absolute;
  top: 0px;
  left: 0px;
}           

.layers:hover .over {
  left: -200px; 
}

回答1:


Turns out there is a bug in Firefox (firefox hover opacity) and I solved the problem by changing

.layers:hover .over {}

to

[class="layers"]:hover over {}

I just upgraded to Firefox 5 (from Firefox 4); not sure if the bug has been fixed or not...




回答2:


See this question: Why is my CSS3 Transition not working in Firefox?



来源:https://stackoverflow.com/questions/6309691/css3-transition-hover-effect-not-working-in-firefox-a-firefox-bug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!