2
Guys need help with CSS3. I’m using keyframes/Animation to change the image of several article classes, where I’m using CSS to change the background in the following percentages 0, 30, 35, 65, 70, 100. The problem is in the fact that the first class called mile, is changing perfectly and I just replicated the code for the other classes, the penultimate class is changing but only 2 images. Follow the code below
HTML5
<div class="secao">
<section>
<article class="milha"><span class="badge badge-secondary" id="badge1">categoria 1</span></h3></article>
<article class="farol"><span class="badge badge-secondary" id="badge2">categoria 1</span></h3></article>
<article class="roda"><span class="badge badge-secondary" id="badge3">categoria 1</span></h3></article>
<article class="capo"><span class="badge badge-secondary" id="badge4">categoria 1</span></h3></article>
<article class="retrovisor"><span class="badge badge-secondary" id="badge5">categoria 1</span></h3></article>
<article class="porta"><span class="badge badge-secondary" id="badge6">categoria 1</span></h3></article>
</section>
</div>
Below follows the CSS3 used to change these classes.
.milha{
background-image: url(b2.jpg);
background-position: 50% 50%;
background-repeat: no-repeat;
border-radius:12px;
-webkit-animation: slide 5s infinite;
animation: slide 5s infinite;
animation-fill-mode: forwards;
}
.farol{
background-image:url(e2.jpg);
background-position: 50% 50%;
background-repeat: no-repeat;
border-radius:12px;
-webkit-animation:farol 5s infinite;
animation:farol 5s infinite;
}
.roda{
background-image:url(e7.jpg);
background-position: 50% 50%;
background-repeat: no-repeat;
border-radius:12px;
-webkit-animation: slidesRoda 5s infinite;
animation:roda 5s infinite;
}
.capo{
background-image:url(e5.jpg);
background-position: 50% 50%;
background-repeat: no-repeat;
border-radius:12px;
-webkit-animation: capo 5s infinite;
animation:capo 5s infinite;
}
.porta{
background-image:url(d1.jpg);
background-position: 50% 50%;
background-repeat: no-repeat;
border-radius:12px;
-webkit-animation:porta 5s infinite;
animation:porta 5s infinite;
}
.retrovisor{
background-image:url(a1.jpg);
background-position: 50% 50%;
background-repeat: no-repeat;
border-radius:12px;
-webkit-animation:retrovisor 5s infinite;
animation:retrovisor 5s infinite;
}
@keyframes farol{
0%, 30%{
background-image: url(e2.jpg);
}
35%, 65%{
background-image: url(e3.jpg);
}
70%, 100%{
background-image: url(e4.jpg);
}
}
@-webkit-keyframes farol{
0%, 30%{
background-image: url(e2.jpg);
}
35%, 65%{
background-image: url(e3.jpg);
}
70%, 100%{
background-image: url(e4.jpg);
}
}
@keyframes roda{
0%, 30%{
background-image: url(e7.jpg);
}
35%, 65%{
background-image: url(e8.jpg);
}
70%, 100%{
background-image: url(e9.jpg);
}
}
@-webkit-keyframes roda{
0%, 30%{
background-image: url(e7.jpg);
}
35%, 65%{
background-image: url(e8.jpg);
}
70%, 100%{
background-image: url(e9.jpg);
}
}
@keyframes capo{
0%, 30%{
background-image: url(e5.jpg);
}
35%, 65%{
background-image: url(e6.jpg);
}
70%, 100%{
background-image: url(e10.jpg);
}
}
@-webkit-keyframes capo{
0%, 30%{
background-image: url(e5.jpg);
}
35%, 65%{
background-image: url(e6.jpg);
}
70%, 100%{
background-image: url(e10.jpg);
}
}
@keyframes porta{
0%, 30%{
background-image: url(d1.jpg);
}
35%, 65%{
background-image: url(d2.jpg);
}
70%, 100%{
background-image: url(d3.jpg);
}
}
@-webkit-keyframes porta{
0%, 30%{
background-image: url(d1.jpg);
}
35%, 65%{
background-image: url(d2.jpg);
}
70%, 100%{
background-image: url(d3.jpg);
}
}
@keyframes retrovisor{
0%, 30%{
background-image: url(a1.jpg);
}
35%, 65%{
background-image: url(a2.jpg);
}
70%, 100%{
background-image: url(a3.jpg);
}
}
@-webkit-keyframes retrovisor{
0%, 30%{
background-image: url(a1.jpg);
}
35%, 65%{
background-image: url(a2.jpg);
}
70%, 100%{
background-image: url(a3.jpg);
}
}
@keyframes slide{
0%, 30%{
background-image: url(b1.jpg);
}
35%, 65%{
background-image: url(b2.jpg);
}
70%, 100%{
background-image: url(b3.jpg);
}
}
@-webkit-keyframes slide{
0%, 30%{
background-image: url(b1.jpg);
}
35%, 65%{
background-image: url(b2.jpg);
}
70%, 100%{
background-image: url(b3.jpg);
}
}
Remember that all the images that are contained in the codes are in the same folder.
Publio u said that all images are in the same correct folder. Then make sure they all have the extension .JPG or if you have any images .GIF or .PNG. I tested here and worked normal with my images if you want I put my code. NOTE: the tag
<H3>
html you just closed, but did not open...– hugocsl
really had one or the other image with wrong format, however this has changed absolutely nothing in the functioning of the slides, strange...
– John Jones
Young man, I posted an answer with the code working, see if it matches yours. I noticed you have some class names that are not in the CSS you posted in the question
"badge badge-secondary"
, evaluate this. But see below the code working.– hugocsl