+ 1

CSS slider

I can not understand why it shows only 4 slides. https://code.sololearn.com/W87B0MsxWw4p/#html Tell me where and what is wrong?

22nd Jul 2019, 6:33 AM
Alexander Borichevsky
Alexander Borichevsky - avatar
19 Réponses
+ 2
yes, recalculate the keyframes and add more slides with new values
22nd Jul 2019, 9:04 AM
dozule
dozule - avatar
+ 1
You need more target hooks. CSS after line 84 these show the slides 0, -600, -1200, -1800, -2400, -3000 etc.
22nd Jul 2019, 8:18 AM
dozule
dozule - avatar
+ 1
yes, but first you should know how many slides you need. the more slides the more values
22nd Jul 2019, 8:46 AM
dozule
dozule - avatar
+ 1
You can do it I think. If not I try to show you later (in 4 hours).
22nd Jul 2019, 10:13 AM
dozule
dozule - avatar
+ 1
I see you made it. Great. Congrats. Try this, a little softer and more uniform perhaps. @-webkit-keyframes slide-animation { 0% {opacity:0;} 2% {opacity:1;} 6% {left:0px; opacity:1;} /* +1% = 7% */ 7% {opacity:0.6;} /* +2% = 9% */ /* slide 2 */ 9% {left:-600px; opacity:1;} /* +6% = 15% */ 15% {left:-600px; opacity:1;} /* +1% = 16% */ 16% {opacity:0.6;} /* +2% = 18% */ /* slide 3 */ 18% {left:-1200px; opacity:1;} /* +6% = 24% */ 24% {left:-1200px; opacity:1;} /* +1% = 25% */ 25% {opacity:0.6;} /* +2% = 27% etc */ /* slide 4 */ 27% {left:-1800px; opacity:1;} 33% {left:-1800px; opacity:1;} 34% {opacity:0.6;} /* slide 5 */ 36% {left:-2400px; opacity:1;} 42% {left:-2400px; opacity:1;} 43% {opacity:0.6;} /* slide 6 */ 45% {left:-3000px; opacity:1;} 51% {left:-3000px; opacity:1;} 52% {opacity:0.6;} /* slide 7 */ 54% {left:-3600px; opacity:1;} 60% {left:-3600px; opacity:1;} 61% {opacity:0.6;} /* slide 8 */ 63% {left:-4200px; opacity:1;} 69% {left:-4200px; opacity:1;} 70% {opacity:0.6;} /* slide 9 */ 72% {left:-4800px; opacity:1;} 78% {left:-4800px; opacity:1;} 79% {opacity:0.6;} /* slide 10 */ 81% {left:-5400px; opacity:1;} 87% {left:-5400px; opacity:1;} 88% {opacity:0.6;} /* slide 11 */ 90% {left:-6000px; opacity:1;} 98% {opacity:0.6;} 99% {left:-6000px; opacity:0;} 100% {left:0px; opacity:0;} }
22nd Jul 2019, 1:49 PM
dozule
dozule - avatar
+ 1
You're welcome. It will work with 15+ slides too. You can divide the 100% by 15 or any other number.
22nd Jul 2019, 2:09 PM
dozule
dozule - avatar
+ 1
Probably only with a more complicated script, but it's harder to solve. It may not be worth it.
22nd Jul 2019, 2:34 PM
dozule
dozule - avatar
+ 1
I think with adding or removing <div class="slider-container"> you cannot solve this problem. Independent of the HTML section you should be rewritten and complemented the keyframes part with a script and must calculate the percentage of keyframes depending on the number of slides. Not so easy.
22nd Jul 2019, 3:04 PM
dozule
dozule - avatar
0
then you need to add interest and more values?
22nd Jul 2019, 8:30 AM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
Can I somehow do it through the function? the more slides, the values themselves would increase
22nd Jul 2019, 8:51 AM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
And on the other animation can be done? so not so hard.
22nd Jul 2019, 9:33 AM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
Thank! I will be very grateful
22nd Jul 2019, 10:15 AM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
Thank you very much
22nd Jul 2019, 1:59 PM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
Question. If it will be more than 15 slides ... then how to be
22nd Jul 2019, 2:00 PM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
maybe there is another solution?
22nd Jul 2019, 2:01 PM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
I meant if automating when adding slides was automatically added
22nd Jul 2019, 2:21 PM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
To not constantly rule with your hands css
22nd Jul 2019, 2:22 PM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
must be done so that when adding or removing <div class="slider-container"> % changed and shift values
22nd Jul 2019, 2:38 PM
Alexander Borichevsky
Alexander Borichevsky - avatar
0
I can’t think how to do it through the script
22nd Jul 2019, 2:40 PM
Alexander Borichevsky
Alexander Borichevsky - avatar