更改margin-top时Safari文本跳转/闪烁

时间:2014-03-24 22:12:22

标签: javascript safari webkit

我有这个代码:

            if (curTop > top )
            {
                $text.css("margin-top", Math.abs( rect.top ) + curY + "px");        
            }
            else
            {
                $text.css("margin-top", curY - Math.abs( rect.top ) + "px");            
            }

其中rect是:

            rect        = $text.get( 0 ).getBoundingClientRect();

和curY:

            var curY    = parseInt( $text.css( "margin-top" ) );

我相信这没有错......因为它有效 在chrome和firefox中...但我在safari上是noobish,我不明白为什么 它会闪烁......

提前谢谢!。

1 个答案:

答案 0 :(得分:0)

这个解决方案,但它动画,可能适用于其他人,它对我来说是完美的:

        if ( isSafari )
        {
            $text.css({ "-webkit-transition": "1s ease-in-out" });
        }
相关问题