-
Slider CSS3 - HTML5 does not loop
Done ! I had to separate the 3 animations to make them independant : anim_slides1, anim_slides2, anim_slides3. CSS .slides { width: 100%; height: 100%; max-width: 100%; max-height: auto; overflow: hidden; position: relative; margin-left: auto; margin-right: auto; margin: 0 auto; background: #fff; } .slides ul { margin-top:0; list-style:none; position:relative; padding: 0; } .slides ul li img { display:block; } /* keyframes */ @-webkit-keyframes anim_slides1 { 0%, 23%, 100% {opacity:1;} 36%, 90% {opacity:0;} } @-webkit-keyframes anim_slides2 { 0%, 23%, 69%, 100% {opacity:0;} 36%, 56% {opacity:1;} } @-webkit-keyframes anim_slides3 { 0%, 56%, 100% {opacity:0;} 69%, 89% {opacity:1;} } @-moz-keyframes anim_slides1 { 0%, 23%, 100% {opacity:1;} 36%, 90% {opacity:0;} } @-moz-keyframes anim_slides2 { 0%, 23%, 69%, 100% {opacity:0;} 36%, 56% {opacity:1;} } @-moz-keyframes anim_slides3 { 0%, 56%, 100% {opacity:0;} 69%, 89% {opacity:1;} } .slides ul li { opacity:0; position:absolute; top:0; /* animation css3 avec 9 sec pour temps total du slideshow */ -webkit-animation-duration: 9s; -moz-animation-duration: 9s; -ms-animation-duration: 9s; -o-animation-duration: 9s; animation-duration: 9s; -webkit-animation-timing-function: linear; -moz-animation-timing-function: linear; -ms-animation-timing-function: linear; -o-animation-timing-function: linear; animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -moz-animation-iteration-count: infinite; -ms-animation-iteration-count: infinite; -o-animation-iteration-count: infinite; animation-iteration-count: infinite; } .slides ul li:nth-child(1), .slides ul li:nth-child(1) div { -webkit-animation-name: anim_slides1; -moz-animation-name: anim_slides1; -ms-animation-name: anim_slides1; -o-animation-name: anim_slides1; animation-name: anim_slides1; } .slides ul li:nth-child(2), .slides ul li:nth-child(2) div { -webkit-animation-name: anim_slides2; -moz-animation-name: anim_slides2; -ms-animation-name: anim_slides2; -o-animation-name: anim_slides2; animation-name: anim_slides2; } .slides ul li:nth-child(3), .slides ul li:nth-child(3) div { -webkit-animation-name: anim_slides3; -moz-animation-name: anim_slides3; -ms-animation-name: anim_slides3; -o-animation-name: anim_slides3; animation-name: anim_slides3; } Next step : I linked each image towards websites, but when my cursor points on image, only the last link (site3.com) is active. What can I do ? <link href="slideshow.css" rel="stylesheet" /> <div class="slides"> <ul> <li><a href="http://www.site1.com"><img src="slider-tropicspa-2016.jpg" width="100%" /></a></li> <li><a href="http://www.site2.com"><img src="slider-clairazur-2016.jpg" width="100%" /></a></li> <li><a href="http://www.site3.com"><img src="slider-promo-2016.jpg" width="100%" /></a></li> </ul> </div>
-
Slider CSS3 - HTML5 does not loop
Hi, My script (responsive) displays 3 images one by one for 3 sec each (total 9 sec). In the CSS, I set animation-iteration-count: infinite; ,but it plays only one cycle and stops on last image. Have you got any ideas to fix it up ? Thanx. Laurent. HTML <link href="slideshow.css" rel="stylesheet" /> <div class="slides"> <ul> <li><img src="slider-tropicspa-2016.jpg" width="100%" /></li> <li><img src="slider-clairazur-2016.jpg" width="100%" /></li> <li><img src="slider-spa-promo-2016.jpg" width="100%" /></li> </ul> </div> CSS 3 .slides { width: 100%; height: 100%; max-width: 100%; max-height: auto; overflow: hidden; position: relative; margin-left: auto; margin-right: auto; margin: 0 auto; background: #fff; display: block; } .slides ul { margin-top:0; list-style:none; position:relative; padding: 0; } .slides ul li img { display:block; } .slides ul li { opacity: 0; position:absolute; top:0; -webkit-animation-name: anim_slides; -moz-animation-name: anim_slides; -ms-animation-name: anim_slides; -o-animation-name: anim_slides; animation-name: anim_slides; -webkit-animation-duration: 9s; -moz-animation-duration: 9s; -ms-animation-duration: 9s; -o-animation-duration: 9s; animation-duration: 9s; -webkit-animation-timing-function: linear; -moz-animation-timing-function: linear; -ms-animation-timing-function: linear; -o-animation-timing-function: linear; animation-timing-function: linear; -webkit-animation-iteration-count: infinite; -moz-animation-iteration-count: infinite; -ms-animation-iteration-count: infinite; -o-animation-iteration-count: infinite; animation-iteration-count: infinite; } /* keyframes Name:#anim_slides / No effect */ @-webkit-keyframes anim_slides { 0%,100% {opacity:1;} } @-moz-keyframes anim_slides { 0%,100% {opacity:1;} } @-ms-keyframes anim_slides { 0%,100% {opacity:1;} } @-o-keyframes anim_slides { 0%,100% {opacity:1;} } @keyframes anim_slides { 0%,100% {opacity:1;} } /* delay 2s = Wait 2 seconds, then start the animation */ .slides ul li:nth-child(1) { animation-delay: 0s; } .slides ul li:nth-child(2) { animation-delay: 3s; } .slides ul li:nth-child(3) { animation-delay: 6s; } slider5.zip
- Slider CSS3 - HTML5 not responsive, why ?
- Slider CSS3 - HTML5 not responsive, why ?
-
Slider CSS3 - HTML5 not responsive, why ?
Hi, Here is some code to display a responsive slider with 4 pictures of 980 x 220 pixels. I am a newbie with css3 and I don't understand why this slider is not responsive at all ? I forget to say that, html below must stay in 1140px DIV. Thank you for yours replies. Laurent (sorry for my english, I try to do my best too !) index.html <link href="slideshow.css" rel="stylesheet" /> <section class="one_container_980"> <div class="all_container slide"> <img src="slider-tropicspa-2016.jpg" /> <img src="slider-clairazur-2016.jpg" /> <img src="slider-spa-promo-2016.jpg" /> <img src="slider-eauplaisir-2016.jpg" /> </div> </section> slideshow.css body{background-color: #eee;} .one_container_980 { width: 980px; height: 220px; max-width: 1140px; max-height: 220px; margin: 0 auto; overflow: hidden; list-style: none; margin-left: auto; margin-right: auto; } .all_container { // partie qui glisse width: 3940px; height: 220px; transition: 1s ease; } .all_container:hover { animation-play-state: paused; } .picture_slider_980 { max-width: 1140px; max-height: 220px; display: inline-block; } .slide { animation: slide 13s ease infinite; } @keyframes slide { 0% {transform: translateX(0%);} 12% {transform: translateX(0%);} 25% {transform: translateX(-25%);} 37% {transform: translateX(-25%);} 50% {transform: translateX(-50%);} 62% {transform: translateX(-50%);} 75% {transform: translateX(-75%);} 87% {transform: translateX(-75%);} 99% {transform: translateX(-75%);} 100% {transform: translateX(0);} } slider3.zip