Is there an alternative to background-size:cover?

后端 未结 2 2071
不思量自难忘°
不思量自难忘° 2021-02-06 19:08

When using Chrome in particular, it creates a significant scrolling lag and also affects animations on the page and makes them stutter really badly.

So is there an alter

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-06 19:15

    Try it ,

       background-size:cover;
       -moz-background-size:cover;
       -o-background-size:cover;
       -webkit-background-size:cover;
    

    or you can try with javascript ,

    function actualizar_fondo(imagen){
        $('body').css({"background":"url(img/"+imagen+".jpg) no-repeat center center fixed"});
        $('body').css({"-webkit-background-size":"cover"});
        $('body').css({"-moz-background-size":"cover"});
        $('body').css({"-o-background-size":"cover"});
        $('body').css({"background-size":"cover"});
                                     }
    

    Or you can go to this link as falguni said . Here is documentation !

提交回复
热议问题