【问题标题】:Flickering animation in FirefoxFirefox 中的闪烁动画
【发布时间】:2012-10-16 16:08:16
【问题描述】:

我正在做一个仅使用 CSS 的滑出式登录框。我面临的问题是,在 FireFox(我使用的是 Firefox 16.0)中,滑出动画会闪烁。它在 chrome 和 Safari 中运行良好(IE 中没有动画但不闪烁,登录框显示正常)。 这是 HTML:

<div id="slideout">
        <div id="slideout_inner">
             <form id="loginForm" action="#" method="POST">
                <table cellspacing="0">
                    <tbody>
                        <tr>
                            <td><label for="lUsername">Username</label></td>
                            <td><label for="lPassword">Password</label></td>
                        </tr>
                        <tr>
                            <td><input type="text" name="username" id="lUsername" class="required" /></td>
                            <td><input type="password" name="password" id="lPassword" class="required" /></td>
                            <td><input type="submit" value="Login" /></td>
                        </tr>
                        <tr>
                            <td><span class="error"></span></td>
                            <td><span class="error"></span></td>
                        </tr>

                    </tbody>
                </table>
            </form>
        </div>
        <label>Login</label>

这里是 CSS

#slideout {
  position: fixed;
  top: 0px;
  left: 0;
  -webkit-transition-duration: 0.3s;
  -moz-transition-duration: 0.3s;
  -o-transition-duration: 0.3s;
  transition-duration: 0.3s;
}
#slideout_inner {
  position: fixed;
  top: -250px;
  left: 0px;
  -webkit-transition-duration: 0.3s;
  -moz-transition-duration: 0.3s;
  -o-transition-duration: 0.3s;
  transition-duration: 0.3s;
}
#slideout:hover{
  top: 250px;
}
#slideout:hover #slideout_inner{
  top: 0;
}

这里是问题的JSFiddle 如何解决 Firefox 中的闪烁问题?谢谢

【问题讨论】:

    标签: html firefox css


    【解决方案1】:

    这个JSFiddle 或许能帮到你。

    这样写:

    #slideout {
      position: fixed;
      top: 0;
      left: 0;
    }
    #slideout_inner{
        height:0;
        -webkit-transition-duration: 0.3s;
      -moz-transition-duration: 0.3s;
      -o-transition-duration: 0.3s;
      transition-duration: 0.3s;
      overflow:hidden;
    }
    #slideout:hover #slideout_inner{
      height:200px;
      border:1px solid red;
    }
    

    这个JSFiddle

    【讨论】:

    • 我只是定义了#slideout_inner的高度。从中删除 position:fixed 并在悬停时对其进行动画处理。
    猜你喜欢
    • 2014-07-22
    • 2015-09-11
    • 2011-09-13
    • 1970-01-01
    • 2011-08-06
    • 2015-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多