Poor performance of Chrome using background-size: cover

蹲街弑〆低调 提交于 2019-11-27 07:30:30

问题


I need to cover background in my site and I always see lags/slugs on mouse over or any other action. Do you have any idea how to fix this issue? I have a working example here (If I didnt update the code yet) : http://natgeo.geryit.com

ul#posters li {
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    float: left;
    height: 170px;
    position: relative;
    width: 25%;
}

回答1:


It appears webkit doesn't cache the resized image and renders it every time, causing the lag.

You're out of luck when it comes to background-size in chrome.

I've seen people do it with Javascript / jQuery. See http://srobbin.com/jquery-plugins/jquery-backstretch/



来源:https://stackoverflow.com/questions/7869086/poor-performance-of-chrome-using-background-size-cover

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