图片尺寸太大
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Title</title> <style> body { margin: 0; } .body { position: absolute; width: 100vw; height: 100vh; overflow: hidden; } img { display: block; width: 100%; } .DESCENTE-H5_TEC-Allterrain { width: 100%; height: calc(6500 / 900 * 100vw); background: url("./images/DESCENTE-H5_TEC-Allterrain.png") 0 0 / 100% no-repeat; transform: translate3d(0, 0, 0); } .DESCENTE-H5_TEC-Allterrain_01 { width: 100%; /*height: 3250px;*/ height: calc(3250 / 900 * 100vw); background: url("./images/DESCENTE-H5_TEC-Allterrain_01.jpg") 0 0 /100% no-repeat; } .DESCENTE-H5_TEC-Allterrain_02 { width: 100%; height: calc(3250 / 900 * 100vw); background: url("./images/DESCENTE-H5_TEC-Allterrain_02.jpg") 0 0 /100% no-repeat; } </style> <script src="scripts/bscroll.min.js"></script> </head> <body> <div class="body"> <div class="DESCENTE-H5_TEC-Allterrain"> <!--<div class="DESCENTE-H5_TEC-Allterrain_01"></div>--> <!--<div class="DESCENTE-H5_TEC-Allterrain_02"></div>--> </div> </div> </body> </html>
大图切割成俩张后
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Title</title> <style> body { margin: 0; } .body { position: absolute; width: 100vw; height: 100vh; overflow: hidden; } img { display: block; width: 100%; } .DESCENTE-H5_TEC-Allterrain { width: 100%; height: calc(6500 / 900 * 100vw); background: url("./images/DESCENTE-H5_TEC-Allterrain.png") 0 0 / 100% no-repeat; transform: translate3d(0, 0, 0); } .DESCENTE-H5_TEC-Allterrain_01 { width: 100%; /*height: 3250px;*/ height: calc(3250 / 900 * 100vw); background: url("./images/DESCENTE-H5_TEC-Allterrain_01.jpg") 0 0 /100% no-repeat; } .DESCENTE-H5_TEC-Allterrain_02 { width: 100%; height: calc(3250 / 900 * 100vw); background: url("./images/DESCENTE-H5_TEC-Allterrain_02.jpg") 0 0 /100% no-repeat; } </style> <script src="scripts/bscroll.min.js"></script> </head> <body> <div class="body"> <div class="DESCENTE-H5_TEC-Allterrain"> <div class="DESCENTE-H5_TEC-Allterrain_01"></div> <div class="DESCENTE-H5_TEC-Allterrain_02"></div> </div> </div> <script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script> <script> $(function () { new BScroll('.body') }) </script> </body> </html>