Image shifting/jumping after CSS transition effect with scale transform in Firefox

后端 未结 4 1907
清歌不尽
清歌不尽 2021-02-20 04:37

I have a problem in latest Firefox browser version 34 (system: Windows 7, screen width: 1600px). I made effect with zooming images (in some container) after hov

4条回答
  •  独厮守ぢ
    2021-02-20 05:18

    I have just run into this same problem now. The solutions here didn't fix the issue, so I'm posting what I did to get this to work.

    Like OP I had a container with oveflow hidden and was the same size as the image inside it. The image would scale on hover to create a 'zoom' effect - but when initially starting and ending the transition, the image was "jumping"/growing a tiny bit on the bottom and right-hand side. This made it jumpy and not smooth.

    I had calculated the dimensions of my components based off of percentages, which caused them to be non-integers (Chrome). I have a feeling Scale & Scale3d round the pixel values when scaling, which caused this jump. I gave a parent container display:table, which caused all children to have their width/heights be rounded to be an integer value. This fixed the issue for me, and the images now scale smoothly!

提交回复
热议问题