【问题标题】:Transition not working in FireFox转换在 FireFox 中不起作用
【发布时间】:2014-08-14 11:31:04
【问题描述】:

我在图像上制作了这种悬停效果,它可以正常工作。火狐除外。 粉红色背景有效,但正方形没有过渡。我尝试使用-moz-transform,没有用。我尝试将'all'更改为transform,但仍然无效。

有人可以帮我吗?

这是小提琴:

HTML:

    <div id="img">
        <div id="overlay">
            <div class="expand">
        </div>
    </div>
</div>

CSS:

#img {
    height: 150px;
    width: 350px;
    background: url('http://placehold.it/350x150');
}

#img #overlay {
    background: rgba(229, 66, 147, 0);
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
    height: 150px;
    width: 350px;
}

#img #overlay:hover {
    display: block;
    position: absolute;
    background: rgba(229, 66, 147, 0.6);
    z-index: 20;
    overflow: hidden;
    height: 150px;
    width: 350px;
}
.expand {
    display: inline-block;
    margin: auto;
    margin-left: 39%;
    margin-top: 12%;
    z-index: 100;
    width: 60px;
    height: 60px;
    border: solid 5px #fff;
    color: #fff;
    line-height: 50px;
    font-weight: 700;
    font-size: 30px;
    transform: scale(0);
    opacity: 0;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
}

#img #overlay:hover .expand {
    transform: scale(1);
    opacity: 1;
}

http://jsfiddle.net/9qeywb75/

【问题讨论】:

  • 我不知道有什么影响,但是当您将 position: absolute;overflow: hidden;#img #overlay:hover 移动到 #img #overlay 时,FireFox 似乎一切正常!
  • 工作正常!非常感谢。
  • 我找到了原因 - FF 中有一个错误 - 我已经用简短的描述添加了你的问题的答案 - link
  • 如果我的回答完全让你满意,请回答这个问题:)

标签: css


【解决方案1】:

Firefox 中有一个错误 - Bug 625289。当您更改元素需要重建时,FF 中的转换似乎不起作用 - 例如它的位置改变了。

要解决这个问题,只需将 position: absolute;overflow: hidden;#img #overlay:hover 移动到 #img #overlay,它就会在 FF 中工作!

【讨论】:

    猜你喜欢
    • 2015-05-11
    • 2014-06-26
    • 2013-11-27
    • 2013-06-26
    • 1970-01-01
    • 2013-01-21
    • 2012-10-23
    • 2014-10-07
    • 1970-01-01
    相关资源
    最近更新 更多