-2
In Javascript every time I enter the setTimeout calling the previous function and putting the milliseconds does not work. My goal is to automate the passage of frames, but I want to do with pure JS. Will I have to use the FOR loop?
<html>
<head>
<title>Slide</title>
<style type="text/css">
body {
margin: 0px;
}
.box-main {
height: 500px;
width: 900px;
border: 5px solid gray;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow: hidden;
}
.box-images {
position: absolute;
left: 0px;
height: 500px;
width: 2700px;
transition: 1s all linear;
}
.box-img1, .box-img2, .box-img3 {
height: 500px;
width: 900px;
float: right;
}
.box-pointer {
height: 500px;
width: 900px;
position: absolute;
display: flex;
justify-content: center;
align-items: flex-end;
z-index: 10;
}
.box-pointer-int {
margin-bottom: 20px;
}
.pointer1, .pointer2, .pointer3 {
height: 16px;
width: 16px;
border-radius: 8px;
background-color: gray;
float: left;
margin-right: 5px;
margin-left: 5px;
opacity: 0.5;
}
</style>
</head>
<body>
<div class = "box-main">
<div class = "box-images">
<div class = "box-img1" style = "background-color: red;"></div>
<div class = "box-img2" style = "background-color: blue;"></div>
<div class = "box-img3" style = "background-color: yellow;"></div>
</div>
<div class = "box-pointer">
<div class = "box-pointer-int">
<div class = "pointer3" onclick = "passar3()"></div>
<div class = "pointer2" onclick = "passar2()"></div>
<div class = "pointer1" onclick = "passar1()"></div>
</div>
</div>
</div>
<script type="text/javascript">
var intervalo = 3000;
function passar3() {
document.getElementsByClassName("box-images")[0].style.left = "0px";
}
function passar2() {
document.getElementsByClassName("box-images")[0].style.left = "-900px";
}
function passar1() {
document.getElementsByClassName("box-images")[0].style.left = "-1800px";
}
</script>
</body>
</html>
There was only the question of updating when you are clicked on the balls... but that I know how to do and only added to the script. I want to thank you, but the policy here tells us users not to do it by these means.
– Julio Rodrigues