0
Here is my code:
var myIndex1 = 0;
var myIndex2 = 0;
var myIndex3 = 0;
carousel();
function carousel() {
var i;
var x1 = document.getElementsByClassName("mySlides1");
var x2 = document.getElementsByClassName("mySlides2");
var x3 = document.getElementsByClassName("mySlides3");
for (i = 0; i < x1.length; i++) {
x1[i].style.display = "none";
}
for (i = 0; i < x2.length; i++) {
x2[i].style.display = "none";
}
for (i = 0; i < x3.length; i++) {
x3[i].style.display = "none";
}
myIndex1++;
if (myIndex1 > x1.length) {myIndex1 = 1}
x1[myIndex1-1].style.display = "block";
myIndex2++;
if (myIndex2 > x2.length) {myIndex2 = 1}
x2[myIndex2-1].style.display = "block";
myIndex3++;
if (myIndex3 > x3.length) {myIndex3 = 1}
x3[myIndex3-1].style.display = "block";
setTimeout(carousel, 2000);
}
<div class="w3-content w3-section" >
<img class="mySlides1" src="1.png" width="250" height="200" hspace="250px" vspace="50px" border="3">
<img class="mySlides1" src="2.jpg" width="250" height="200" hspace="250px" vspace="50px" border="3">
<img class="mySlides1" src="3.jpg" width="250" height="200" hspace="250px" vspace="50px" border="3">
<img class="mySlides1" src="4.jpg" width="250" height="200" hspace="250px" vspace="50px" border="3">
<img class="mySlides1" src="5.jpg" width="250" height="200" hspace="250px" vspace="50px" border="3">
<img class="mySlides1" src="6.jpg" width="250" height="200" hspace="250px" vspace="50px" border="3">
<img class="mySlides2" src="cozinheiro1.jpg" width="250" height="200" hspace="530px" vspace="50px" border="3">
<img class="mySlides2" src="cozinheiro2.jpg" width="250" height="200" hspace="530px" vspace="50px" border="3">
<img class="mySlides2" src="cozinheiro3.jpg" width="250" height="200" hspace="530px" vspace="50px" border="3">
<img class="mySlides2" src="cozinheiro4.jpg" width="250" height="200" hspace="530px" vspace="50px" border="3">
<img class="mySlides2" src="cozinheiro5.jpg" width="250" height="200" hspace="530px" vspace="50px" border="3">
<img class="mySlides2" src="cozinheiro6.jpg" width="250" height="200" hspace="530px" vspace="50px" border="3">
<img class="mySlides3" src="larive1.jpg" width="250" height="200" hspace="810px" vspace="50px" border="3">
<img class="mySlides3" src="larive2.jpg" width="250" height="200" hspace="810px" vspace="50px" border="3">
<img class="mySlides3" src="larive3.jpg" width="250" height="200" hspace="810px" vspace="50px" border="3">
<img class="mySlides3" src="larive4.jpg" width="250" height="200" hspace="810px" vspace="50px" border="3">
<img class="mySlides3" src="larive5.jpg" width="250" height="200" hspace="810px" vspace="50px" border="3">
<img class="mySlides3" src="larive6.jpg" width="250" height="200" hspace="810px" vspace="50px" border="3">
</div>
Luke better your title. Be objective with just 5 or 6 words. The rest you put in the text body of the question. Also put your HTML and CSS for easy response.
– hugocsl
if I put all the code I don’t know why but cuts the html and css and a little java
– user100698
Lucas uses the tool "Javascript/HTML/CSS snippet (Ctrl-M)" in the question field. It is the seventh option, next to insert Image.
– hugocsl
sorry. I’m new to programming I didn’t understand what you said
– user100698
@Lucassintra copied to the snippet, now you need to edit adding the css and explain better what you want to do.
– Leandro Angelo
i didn’t use css for the images. basically what I want to do is: have 3 slides of images run automatically. I’ve been able to do that but the problem is that they’re not on the same line. I have already used hspace and vspace to see if they are on the same line but not.
– user100698