Dieses Beispiel teilt die Implementierung des nahtlosen Scrolling -Effekts JavaScript -Code für Ihre Referenz. Der spezifische Inhalt ist wie folgt]
Reproduktionsbild:
Implementierungscode:
<! DocType html> <html> <kopf> <meta charset = "gb2312" /> <title> zzzz < /title> <style> *{Margin: 0; Polsterung: 0; } body {width: 1000px; Rand: 100px Auto; Hintergrundfarbe: #fff; } #Wrapper {Überlauf: versteckt; Breite: 600px; Höhe: 100px; Position: Relativ; } #Wrapper ul {Position: absolut; links: 0; Top: 0; } #wrapper li {float: links; Listenstil: Keine; } #wrapper li img {width: 150px; Höhe: 100px; Border-Radius: 9px; } input [type = button] {margin-top: 20px; Breite: 35px; Höhe: 25px; Zeilenhöhe: 25px; } </style> <script type = "text/javaScript"> window.onload = function () {var timer = null; var speed = 4; var od = document.getElementById ("Wrapper"); var au = od.getElementsByTagName ('ul') [0]; var ali = au.getElementsByTagName ('li'); au.innerhtml = au.innerhtml+au au timer = setInterval (move, 30) function move () {if (au.offsetleft <-au.offsetwidth/2) {au } if (au.offsetLeft> 0) {au } au.style.left = au.offsetleft+speed+'px'; } od.onmouseover = function () {ClearInterval (Timer); } od.onmouseout = function () {timer = setInterval (move, 30)} document.getElementById ("btn1"). onclick = function () {speed = -4; } document.getElementById ("btn2"). onclick = function () {speed = 4; } } </script> </head> <body> <div id="wrapper"> <ul> <li><img src="img/pic4.jpg"/></li> <li><img src="img/pic3.jpg"/></li> <li><img src="img/pic2.jpg"/></li> <li><img src = "img/pic2.jpg"/> </li> <li> <img src = "img/pic1.jpg"/> </li> </ul> </div> <input type = "button" name = "" id = "btn1" value = "links"/> </<Eingabe type = "butth =" bttn2 "=" buttn2 "Sie können sich auf die folgenden Themen für das Studium beziehen:
"JavaScript Scrolling Effect Summary", "JQuery Scrolling Effect Summary", "JavaScript Bild Carousel Effect Summary"
Das obige dreht sich alles um diesen Artikel, und ich hoffe, dass es für alle hilfreich sein wird, JavaScript -Programme zu lernen.