jquery animate (height) causes background-image flickering in firefox

独自空忆成欢 提交于 2019-12-02 05:55:07

问题


I have a little Problem using jQuery.animate with firefox: when i animate the height of a container with some background image, the background starts to flicker on firefox only - all other browsers (even ie) show a smooth animation. a reduced code snippet that shows what i do:

<div style="background-image:url(image.jpg);background-position:50% 50%;height:200px;"
      onmouseover="jQuery(this).animate({height:400});"></div>

I would greatly appreciate your help.


回答1:


Out of interest, what happens if you wrap that in another DIV and animate that, e.g.

<div style="background-position:50% 50%;height:200px;" onmouseover="jQuery(this).animate({height:400});">
     <div style="background-image:url(image.jpg);"></div>
</div>

(For the record, I've used your code, but would have preferred using CSS Classes and Late jQuery event binding ;-)



来源:https://stackoverflow.com/questions/2183508/jquery-animate-height-causes-background-image-flickering-in-firefox

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