slideshow | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

slideshow

how can i make a loop slideshow , i mean images don't have any end

26th Jun 2016, 7:21 AM
Laurentiu Amzarescu
Laurentiu Amzarescu - avatar
5 Answers
+ 4
<body <div id="captioned-gallery"> <figure class="slider"> <figure> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/hobbiton-lake.jpg" alt> <figcaption>Hobbiton, New Zealand</figcaption> </figure> <figure> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/wanaka-drowned-tree.jpg" alt> <figcaption>Wanaka, New Zealand</figcaption> </figure> <figure> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/utah-peak.jpg" alt> <figcaption>Utah, United States</figcaption> </figure> <figure> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/bryce-canyon-utah.jpg" alt> <figcaption>Bryce Canyon, Utah, United States</figcaption> </figure> <figure> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/hobbiton-lake.jpg" alt> <figcaption>Hobbiton, New Zealand</figcaption> </figure> </figure> </div> </body> </html>
26th Jun 2016, 6:23 PM
ZinC
ZinC - avatar
+ 3
Try this. No js. (not my code). I have to split the code in two posts since I couldn't do it in one.: <!DOCTYPE html> <html> <head> <title>Page Title</title> <style @keyframes slidy { 0% { left: 0%; } 20% { left: 0%; } 25% { left: -100%; } 45% { left: -100%; } 50% { left: -200%; } 70% { left: -200%; } 75% { left: -300%; } 95% { left: -300%; } 100% { left: -400%; } } body, figure { margin: 0; background: #101010; font-family: Tahoma, sans-serif; font-weight: 100; } div#captioned-gallery { width: 100%; overflow: hidden; } figure.slider { position: relative; width: 500%; font-size: 0; animation: 30s slidy infinite; } figure.slider figure { width: 20%; height: auto; display: inline-block; position: inherit; } figure.slider img { width: 100%; height: auto; } figure.slider figure figcaption { position: absolute; bottom: 0; background: rgba(0,0,0,0.4); color: #fff; width: 100%; font-size: 2rem; padding: .6rem; } </style> </head>
26th Jun 2016, 6:22 PM
ZinC
ZinC - avatar
0
thanks Aman :) i'll try to find a way with css
26th Jun 2016, 1:09 PM
Laurentiu Amzarescu
Laurentiu Amzarescu - avatar
- 1
Thanks ZinC, your posts are appreciated! I added the missing '>' in the opening <style> tag and this works great!
9th Oct 2016, 6:31 PM
Tom
Tom - avatar
- 2
j
26th Jun 2016, 9:09 AM
brian vanes
brian vanes - avatar