0
이 HTML 코드를 사용하여 선택 윤곽 효과를 얻지 만 첫 번째 이미지와 마지막 이미지 사이에 간격이 있습니다. 어떻게하면 자바 스크립트를 사용하여 지속적인 선택 윤곽 효과를 얻으려면이 공백을 제거 할 수 있습니다. 보다 효율적으로이 작업을 수행하는 다른 방법이있는 경우 또한 어떻게 자바 스크립트에서 연속적인 이미지 윤곽 효과를 얻을 수 있습니까?
var Obj = null;
var animate ;
function init(){
Obj = document.getElementById('mover');
Obj.style.position= 'relative';
Obj.style.left = '-600px';
}
function moveRight(){
Obj.style.left = parseInt(Obj.style.left) + 1 + 'px';
animate = setTimeout(moveRight,20);
if(parseInt(Obj.style.left)>800)
Obj.style.left = '-600px';
}
function stop(){
clearTimeout(animate);
Obj.style.left = '-600px';
}
window.onload =init;
#wrapper {
width:800px;
overflow: hidden;
}
#mover{
width:10000px;
overflow: hidden;
}
img{
padding: 0px;
margin: -2px;
display: inline;
}
<html>
<head>
<title>JavaScript Animation</title>
</head>
<body>
<form>
<div id="wrapper">
<div id="mover">
<img id="myImage" src="http://lorempixel.com/g/200/150/cats/1" width="200" height="150" />
<img id="myImage" src="http://lorempixel.com/g/200/150/cats/2" width="200" height="150" />
<img id="myImage" src="http://lorempixel.com/g/200/150/cats/3" width="200" height="150" />
</div>
</div>
<p>Click the buttons below to handle animation</p>
<input type="button" value="Start" onclick="moveRight();" />
<input type="button" value="Stop" onclick="stop();" />
</form>
</body>
</html>