Artikel ini berbagi kode implementasi gulir loop loop JS untuk referensi Anda. Konten spesifiknya adalah sebagai berikut
1. Format gambar: 260*400.
2. Gunakan timer loop untuk dengan mudah mengimplementasikannya
<! Doctype html> <html lang = "en"> <head> <meta charset = "utf-8"> <itement> gulir mulus </iteme> </head> <style type = "text/css"> .row {width: 1298px; Tinggi: 400px; Perbatasan: 1px padat; Kotak-Shadow: 2px 2px 2px #000; meluap: tersembunyi; } .box {position: relatif; } .box1, .box2 {width: 1298px; Posisi: Absolute; } .box2 {kiri: 1298px; } img {float: kiri; } </style> <body> <div> <Div id = "box"> <div id = "box1"> <img src = "gambar/1.jpg"> <img src = "gambar/2.jpg"> <img src = "gambar/3.jpg"> <mages src = "gambar/4.jpg"> <"iMg =" Imger/Images SRC = "Images/4.JPG"> <iMg ">" IMG. "IMGRICE/IMAGZE/IMAGZES/IMAGZE/IMAGZE/IMAGZE/IMAGZE/IMAGZE/IMAGZE/3.JPG"> id="box2"> <img src="images/1.jpg"> <img src="images/2.jpg"> <img src="images/3.jpg"> <img src="images/4.jpg"> <img src="images/5.jpg"> </div> </div> </div> </div></body><script type = "text/javascript"> window.onload = function () {var _box1 = document.getElementById ("box1"); var _box2 = document.getElementById ("box2"); var x = 0; var fun = function () {_box1.style.left = x + 'px'; _box2.style.left = (x +1298) + 'px'; X--; if ((x +1298) == 0) {x = 0; }} setInterval (fun, 1); } </script> </html>Di atas adalah semua tentang artikel ini, saya harap ini akan membantu untuk pembelajaran semua orang.