I'm trying to create the popular "falling snow/object" imagery for a splash page I'm working on. I've got the images and they fall gently, but I'm unable to get an even, "random" spread to the falling. They fall in obvious "clumps". I know it's due to the math used to create them. I've got a math learning disability that makes figuring this out on my own impossible. Can someone look over my code and help me get a less uniform, less clumpy fall of flower petals? Something that looks more natural like a cherry tree being blown and a bunch of petals break loose and float across the splash page.
.petals {
text-align: center;
}
.petals span {
display: inline-block;
width: 19px;
height: 19px;
margin: -219px 40px 54px -34px;
background: #ff0000;
background: url("http://www.cafenocturne.com/testpage/images/MiniPetal.png");
-webkit-animation: petals 15s infinite linear;
-moz-animation: petals 15s infinite linear;
-o-animation: petals 15s infinite linear;
animation: petals 15s infinite linear;
}
.petals span:nth-of-type(5n) {
-webkit-animation-delay: 1.5s;
-moz-animation-delay: 1.5s;
-o-animation-delay: 1.5s;
animation-delay: 1.5s;
}
.petals span:nth-of-type(5n+1) {
-webkit-animation-delay: 1.3s;
-moz-animation-delay: 1.3s;
-o-animation-delay: 1.3s;
animation-delay: 1.3s;
}
.petals span:nth-of-type(5n+2) {
-webkit-animation-delay: 1s;
-moz-animation-delay: 1s;
-o-animation-delay: 1s;
animation-delay: 1s;
}
.petals span:nth-child(3n) {
-webkit-animation-delay: 1.6s;
-moz-animation-delay: 1.6s;
-o-animation-delay: 1.6s;
animation-delay: 1.6s;
}
.petals span:nth-child(3n+1) {
-webkit-animation-delay: 1.7s;
-moz-animation-delay: 1.7s;
-o-animation-delay: 1.7s;
animation-delay: 1.7s;
}
.petals span:nth-child(3n+2) {
-webkit-animation-delay: 2s;
-moz-animation-delay: 2s;
-o-animation-delay: 2s;
animation-delay: 2s;
}
.petals span:nth-child(7n) {
-webkit-animation-delay: 2.5s;
-moz-animation-delay: 2.5s;
-o-animation-delay: 2.5s;
animation-delay: 2.5s;
}
.petals span:nth-child(7n+1) {
-webkit-animation-delay: 3.2s;
-moz-animation-delay: 3.2s;
-o-animation-delay: 3.2s;
animation-delay: 3.2s;
}
.petals span:nth-child(7n+2) {
-webkit-animation-delay: 3.9s;
-moz-animation-delay: 3.9s;
-o-animation-delay: 3.9s;
animation-delay: 3.9s;
}
.petals span:nth-of-type(5n) {
-webkit-animation-delay: 4.3s;
-moz-animation-delay: 4.3s;
-o-animation-delay: 4.3s;
animation-delay: 4.3s;
}
.petals span:nth-of-type(5n+1) {
-webkit-animation-delay: 4.7s;
-moz-animation-delay: 4.7s;
-o-animation-delay: 4.7s;
animation-delay: 4.7s;
}
.petals span:nth-of-type(5n+2) {
-webkit-animation-delay: 5.3s;
-moz-animation-delay: 5.3s;
-o-animation-delay: 5.3s;
animation-delay: 5.3s;
}
.petals span:nth-child(3n) {
-webkit-animation-delay: 5.5s;
-moz-animation-delay: 5.5s;
-o-animation-delay: 5.5s;
animation-delay: 5.5s;
}
.petals span:nth-child(3n+1) {
-webkit-animation-delay: 6.2s;
-moz-animation-delay: 6.2s;
-o-animation-delay: 6.2s;
animation-delay: 6.2s;
}
.petals span:nth-child(3n+2) {
-webkit-animation-delay: 6.8s;
-moz-animation-delay: 6.8s;
-o-animation-delay: 6.8s;
animation-delay: 6.8s;
}
.petals span:nth-child(7n) {
-webkit-animation-delay: 7.1s;
-moz-animation-delay: 7.1s;
-o-animation-delay: 7.1s;
animation-delay: 7.1s;
}
.petals span:nth-child(7n+1) {
-webkit-animation-delay: 7.7s;
-moz-animation-delay: 7.7s;
-o-animation-delay: 7.7s;
animation-delay: 7.7s;
}
.petals span:nth-child(7n+2) {
-webkit-animation-delay: 8.1s;
-moz-animation-delay: 8.1s;
-o-animation-delay: 8.1s;
animation-delay: 8.1s;
}
.petals span:nth-child(9n) {
-webkit-animation-delay: 8.6s;
-moz-animation-delay: 8.6s;
-o-animation-delay: 8.6s;
animation-delay: 8.6s;
}
.petals span:nth-child(9n+1) {
-webkit-animation-delay: 9.2s;
-moz-animation-delay: 9.2s;
-o-animation-delay: 9.2s;
animation-delay: 9.2s;
}
.petals span:nth-child(9n+2) {
-webkit-animation-delay: 9.8s;
-moz-animation-delay: 9.8s;
-o-animation-delay: 9.8s;
animation-delay: 9.8s;
}
.petals span:nth-child(11n) {
-webkit-animation-delay: 10.3s;
-moz-animation-delay: 10.3s;
-o-animation-delay: 10.3s;
animation-delay: 10.3s;
}
.petals span:nth-child(11n+1) {
-webkit-animation-delay: 10.7s;
-moz-animation-delay: 10.7s;
-o-animation-delay: 10.7s;
animation-delay: 10.7s;
}
.petals span:nth-child(11n+2) {
-webkit-animation-delay: 11.1s;
-moz-animation-delay: 11.1s;
-o-animation-delay: 11.1s;
animation-delay: 11.1s;
}
#-webkit-keyframes petals {
0% {
width: 19px;
height: 19px;
opacity: 1;
-webkit-transform: translate(0, 0px) rotateZ(0deg) rotateY(0deg);
}
75% {
width: 19px;
height: 19px;
opacity: 1;
-webkit-transform: translate(200px, 800px) rotateZ(270deg) rotateY(270deg);
}
100% {
width: 19px;
height: 19px;
opacity: 0;
-webkit-transform: translate(350px, 1000px) rotateZ(360deg) rotateY(360deg);
}
}
#-moz-keyframes petals {
0% {
width: 19px;
height: 19px;
opacity: 1;
-webkit-transform: translate(0, 0px) rotateZ(0deg) rotateY(0deg);
}
75% {
width: 19px;
height: 19px;
opacity: 1;
-webkit-transform: translate(200px, 800px) rotateZ(270deg) rotateY(270deg);
}
100% {
width: 19px;
height: 19px;
opacity: 0;
-webkit-transform: translate(350px, 1000px) rotateZ(360deg) rotateY(360deg);
}
}
<div class="petals">
<span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span>
</div>
,
The easiest way to do this is to just generate the animation-delay randomly for each petal using js (example using jquery, sorry for bad formatting):
function getRandomInt(min, max){
return Math.floor(Math.random() * (max - min + 1)) + min;
}
$(".petals span").each(function() {
var delay = getRandomInt(1, 100) / 10
$(this).css("animation-delay", delay + "s");
});
Demo
Related
I am looking to make a word in a sentence to rotate between multiple options of words automatically with CSS. I want the word to stop at the last word and stay there. How could I do this using html/css?
Here is a link to the codepen.
https://codepen.io/nkangzing/pen/EwyqqM
<style>
.text-wrapper {
text-align: center;
}
.animated-words {
display: inline-block;
}
.animated-words span:nth-child(2) {
-webkit-animation-delay: 3s;
-ms-animation-delay: 3s;
animation-delay: 3s;
color: #6b889d;
}
.animated-words span:nth-child(3) {
-webkit-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
color: #6b739d;
}
.animated-words span:nth-child(4) {
-webkit-animation-delay: 9s;
-ms-animation-delay: 9s;
animation-delay: 9s;
color: #7a6b9d;
}
.animated-words span:nth-child(5) {
-webkit-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
color: #8d6b9d;
}
.animated-words span:nth-child(6) {
-webkit-animation-delay: 15s;
-ms-animation-delay: 15s;
animation-delay: 15s;
color: #9b6b9d;
}
.animated-words span {
position: absolute;
opacity: 0;
overflow: hidden;
color: #6b969d;
-webkit-animation: animateWord 18s linear infinite 0s;
-ms-animation: animateWord 18s linear infinite 0s;
animation: animateWord 18s linear infinite 0s;
}
#-webkit-keyframes animateWord {
0% { opacity: 0; }
2% { opacity: 0; -webkit-transform: translateY(-30px); }
5% { opacity: 1; -webkit-transform: translateY(0px);}
17% { opacity: 1; -webkit-transform: translateY(0px); }
20% { opacity: 0; -webkit-transform: translateY(30px); }
80% { opacity: 0; }
100% { opacity: 0; }
}
</style>
<div class="text-wrapper">
The quick brown fox jumps over the lazy
<div class="animated-words">
<span class="am1">dog.</span>
<span class="am1">horse.</span>
<span class="am1">frog.</span>
<span class="am1">cat.</span>
<span class="am1">mouse.</span>
<span class="am1">rabbit.</span>
</div>
</div>
Here is a link to an example https://tympanus.net/Tutorials/CSS3RotatingWords/
The word keeps looping or just disappears at the end depending on if I put infinite to true.
Full link.
First, change the animation property from infinite to linear:
animation: animateWord 18s linear 1 0s;
Then, for the last name, I don't run the first animation, but another one that looks like this:
#-webkit-keyframes animateWordLast {
0% { opacity: 0; }
2% { opacity: 0; -webkit-transform: translateY(-30px); }
5% { opacity: 1; -webkit-transform: translateY(0px);}
100% { opacity: 1; }
}
To make the last word stay longer (but not forever), adding these at the end seems to do the job:
.animated-words .last {
-webkit-animation: animateWordLast 100s linear 1 18s;
animation: animateWordLast 100s linear 1 18s;
}
#-webkit-keyframes animateWordLast {
0% { opacity: 1; }
100% { opacity: 1; }
}
Check 100s duration, you can put a big number there, say 3600 (1 hr), and 18s the delay of this second animation.
I can't get any of these to work for me .... I'm using similar one with rotating words, and I changed my linear infinite to just linear like you said (not shown)
.rotateWords{
-webkit-animation: rotateWords 12s linear 1 0s;
-moz-animation: rotateWords 12s linear 1 0s;
-o-animation: rotateWords 12s linear 1 0s;
-ms-animation: rotateWords 12s linear 1 0s;
animation: rotateWords 12s linear 1 0s;
}
.rotating-words:nth-child(2) {
-webkit-animation-delay: 2s;
-moz-animation-delay: 2s;
-o-animation-delay: 2s;
-ms-animation-delay: 2s;
animation-delay: 2s;
}
.rotating-words:nth-child(3) {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-o-animation-delay: 4s;
-ms-animation-delay: 4s;
animation-delay: 4s;
}
.rotating-words:nth-child(4) {
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
.rotating-words:nth-child(5) {
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-o-animation-delay: 8s;
-ms-animation-delay: 8s;
animation-delay: 8s;
}
.rotate-last:nth-child(6) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
}
#keyframes rotateWords {
0% {
opacity: 0 ;
}
8% {
opacity: 1 ;
-webkit-animation-timing-function: ease-in;
-moz-animation-timing-function: ease-in;
-o-animation-timing-function: ease-in;
-ms-animation-timing-function: ease-in;
animation-timing-function: ease-in;
}
10% {
opacity: 1;
}
15% {
opacity: 0;
}
100% {
opacity: 0;
}
}
I'm having some problems using CSS animations, I developed my code using Chrome, but now I'm testing it on different browsers I'm having trouble running it on a Safari browser.
JSfiddle
My CSS code
.fade-in {
opacity: 0;
-webkit-animation: fadeIn ease-in 1;
-moz-animation: fadeIn ease-in 1;
-o-animation: fadeIn ease-in 1;
animation: fadeIn ease-in 1;
-webkit-animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-duration: .5s;
-moz-animation-duration: .5s;
-o-animation-duration: .5s;
animation-duration: .5s
}
.one {
-webkit-animation-delay: .2s;
-moz-animation-delay: .2s;
-o-animation-delay: .2s;
animation-delay: .2s
}
.two {
-webkit-animation-delay: .5s;
-moz-animation-delay: .5s;
-o-animation-delay: .5s;
animation-delay: .5s
}
.three {
-webkit-animation-delay: .8s;
-moz-animation-delay: .8s;
-o-animation-delay: .8s;
animation-delay: .8s
}
.four {
-webkit-animation-delay: 1.3s;
-moz-animation-delay: 1.3s;
-o-animation-delay: 1.3s;
animation-delay: 1.3s
}
.five {
-webkit-animation-delay: 1.7s;
-moz-animation-delay: 1.7s;
-o-animation-delay: 1.7s;
animation-delay: 1.7s
}
.six {
-webkit-animation-delay: 2.2s;
-moz-animation-delay: 2.2s;
-o-animation-delay: 2.2s;
animation-delay: 2.2s
}
What this code dose is order a fadein animation when the page loads.
Thank you in advance
I want a smooth css3 slider which is having .png images. On start all the images are displayed for once after that it works fine. I need help to hide three images that are loading when transition starts.
If anybody can help... would be very glad.
PS : I am working on some tool which is restricted use of jquery/javascript. Due to which many solution to my problem aren't implementable.
#-webkit-keyframes cf4FadeInOut {
0% {
opacity:1;
}
15% {
opacity:1;
}
25% {
opacity:0;
}
90% {
opacity:0;
}
100% {
opacity:1;
}
}
#-moz-keyframes cf4FadeInOut {
0% {
opacity:1;
}
15% {
opacity:1;
}
25% {
opacity:0;
}
90% {
opacity:0;
}
100% {
opacity:1;
}
}
#-o-keyframes cf4FadeInOut {
0% {
opacity:1;
}
15% {
opacity:1;
}
25% {
opacity:0;
}
90% {
opacity:0;
}
100% {
opacity:1;
}
}
#keyframes cf4FadeInOut {
0% {
opacity:1;
}
15% {
opacity:1;
}
25% {
opacity:0;
}
90% {
opacity:0;
}
100% {
opacity:1;
}
}
#cf4a {
position:relative;
height:571px;
width:931px;
margin:0 auto;
}
#cf4a img {
position:absolute;
left:0;
}
#cf4a img {
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 24s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 24s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 24s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 24s;
}
#cf4a img:nth-of-type(4) {
-webkit-animation-delay: 18s;
-moz-animation-delay: 18s;
-o-animation-delay: 18s;
animation-delay: 18s;
}
#cf4a img:nth-of-type(3) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
}
#cf4a img:nth-of-type(2) {
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
animation-delay: 6s;
visibility: visible;
}
#cf4a img:nth-of-type(1) {
-webkit-animation-delay: 0;
-moz-animation-delay: 0;
-o-animation-delay: 0;
animation-delay: 0;
}
<div id="cf4a" class="shadow">
<img src="header-img-1.png" />
<img src="header-img-2.png" />
<img src="header-img-3.png" />
<img src="header-img-4.png" />
</div>
#-webkit-keyframes cf4FadeInOut {
0% {
opacity:1;
}
15% {
opacity:1;
}
25% {
opacity:0;
}
90% {
opacity:0;
}
100% {
opacity:1;
}
}
#-moz-keyframes cf4FadeInOut {
0% {
opacity:1;
}
15% {
opacity:1;
}
25% {
opacity:0;
}
90% {
opacity:0;
}
100% {
opacity:1;
}
}
#-o-keyframes cf4FadeInOut {
0% {
opacity:1;
}
15% {
opacity:1;
}
25% {
opacity:0;
}
90% {
opacity:0;
}
100% {
opacity:1;
}
}
#keyframes cf4FadeInOut {
0% {
opacity:1;
}
15% {
opacity:1;
}
25% {
opacity:0;
}
90% {
opacity:0;
}
100% {
opacity:1;
}
}
#cf4a {
position:relative;
height:571px;
width:931px;
margin:0 auto;
}
#cf4a img {
position:absolute;
left:0;
}
#cf4a img {
-webkit-animation: cf4FadeInOut 24s ease-in-out infinite;
-moz-animation: cf4FadeInOut 24s ease-in-out infinite;
-o-animation: cf4FadeInOut 24s ease-in-out infinite;
animation: cf4FadeInOut 24s ease-in-out infinite;
}
#cf4a img:nth-child(4) {
-webkit-animation-delay: 18s;
-moz-animation-delay: 18s;
-o-animation-delay: 18s;
animation-delay: 18s;
}
#cf4a img:nth-child(3) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
}
#cf4a img:nth-child(2) {
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
animation-delay: 6s;
visibility: visible;
}
#cf4a img:nth-child(1) {
-webkit-animation-delay: 0;
-moz-animation-delay: 0;
-o-animation-delay: 0;
animation-delay: 0;
}
<div id="cf4a" class="shadow">
<img src="header-img-1.png" />
<img src="header-img-2.png" />
<img src="header-img-3.png" />
<img src="header-img-4.png" />
</div>
I hope this solves your problem, thy this working fiddle https://jsfiddle.net/3t8qysk6/
I am implementing a CSS slide show on my site. I used this CodePen as a guide: http://codepen.io/antoniskamamis/pen/hjBrE
I first experienced an issue with the Slide Show not working correctly in Safari. I was able to address that issue by adding animation-delay properties that are for all browsers. I tested on all browsers except IE until now, and for some reason this slide show does not work in IE. I can see that the demo (code pen) does in fact work in IE.
Would the additional CSS I added to handle the animations in Safari have caused IE to break? If anyone has an idea, it would be extremely appreciated!
.slider {
margin: 10px auto;
width: 500px;
height: 320px;
overflow: hidden;
position: relative;
}
.photo {
position: absolute;
-webkit-animation: round 16s infinite;
-moz-animation: round 16s infinite;
-ms-animation: round 16s infinite;
-o-animation: round 16s infinite;
animation: round 16s infinite;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
}
#keyframes "round" {
25% {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
}
40% {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
}
}
#-moz-keyframes round {
25% {
filter: alpha(opacity=100);
opacity: 1;
}
40% {
filter: alpha(opacity=0);
opacity: 0;
}
}
#-webkit-keyframes "round" {
25% {
filter: alpha(opacity=100);
opacity: 1;
}
40% {
filter: alpha(opacity=0);
opacity: 0;
}
}
#-ms-keyframes "round" {
25% {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
}
40% {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
}
}
#-o-keyframes "round" {
25% {
filter: alpha(opacity=100);
opacity: 1;
}
40% {
filter: alpha(opacity=0);
opacity: 0;
}
}
.slider img:nth-child(20) {
-webkit-animation-delay: 76s;
-moz-animation-delay: 76s;
-ms-animation-delay: 76s;
-o-animation-delay: 76s;
animation-delay: 76s;
}
.slider img:nth-child(19) {
-webkit-animation-delay: 72s;
-moz-animation-delay: 72s;
-ms-animation-delay: 72s;
-o-animation-delay: 72s;
animation-delay: 72s;
}
.slider img:nth-child(18) {
-webkit-animation-delay: 68s;
-moz-animation-delay: 68s;
-ms-animation-delay: 68s;
-o-animation-delay: 68s;
animation-delay: 68s;
}
.slider img:nth-child(17) {
-webkit-animation-delay: 64s;
-moz-animation-delay: 64s;
-ms-animation-delay: 64s;
-o-animation-delay: 64s;
animation-delay: 64s;
}
.slider img:nth-child(16) {
-webkit-animation-delay: 60s;
-moz-animation-delay: 60s;
-ms-animation-delay: 60s;
-o-animation-delay: 60s;
animation-delay: 60s;
}
.slider img:nth-child(15) {
-webkit-animation-delay: 56s;
-moz-animation-delay: 56s;
-ms-animation-delay: 56s;
-o-animation-delay: 56s;
animation-delay: 56s;
}
.slider img:nth-child(14) {
-webkit-animation-delay: 52s;
-moz-animation-delay: 52s;
-ms-animation-delay: 52s;
-o-animation-delay: 52s;
animation-delay: 52s;
}
.slider img:nth-child(13) {
-webkit-animation-delay: 48s;
-moz-animation-delay: 48s;
-ms-animation-delay: 48s;
-o-animation-delay: 48s;
animation-delay: 48s;
}
.slider img:nth-child(12) {
-webkit-animation-delay: 44s;
-moz-animation-delay: 44s;
-ms-animation-delay: 44s;
-o-animation-delay: 44s;
animation-delay: 44s;
}
.slider img:nth-child(11) {
-webkit-animation-delay: 40s;
-moz-animation-delay: 40s;
-ms-animation-delay: 40s;
-o-animation-delay: 40s;
animation-delay: 40s;
}
slider img:nth-child(10) {
-webkit-animation-delay: 36s;
-moz-animation-delay: 36s;
-ms-animation-delay: 36s;
-o-animation-delay: 36s;
animation-delay: 36s;
}
.slider img:nth-child(9) {
-webkit-animation-delay: 32s;
-moz-animation-delay: 32s;
-ms-animation-delay: 32s;
-o-animation-delay: 32s;
animation-delay: 32s;
}
.slider img:nth-child(8) {
-webkit-animation-delay: 28s;
-moz-animation-delay: 28s;
-ms-animation-delay: 28s;
-o-animation-delay: 28s;
animation-delay: 28s;
}
.slider img:nth-child(7) {
-webkit-animation-delay: 24s;
-moz-animation-delay: 24s;
-ms-animation-delay: 24s;
-o-animation-delay: 24s;
animation-delay: 24s;
}
.slider img:nth-child(6) {
-webkit-animation-delay: 20s;
-moz-animation-delay: 20s;
-ms-animation-delay: 20s;
-o-animation-delay: 20s;
animation-delay: 20s;
}
.slider img:nth-child(5) {
-webkit-animation-delay: 16s;
-moz-animation-delay: 16s;
-ms-animation-delay: 16s;
-o-animation-delay: 16s;
animation-delay: 16s;
}
.slider img:nth-child(4) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-ms-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
}
.slider img:nth-child(3) {
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-ms-animation-delay: 8s;
-o-animation-delay: 8s;
animation-delay: 8s;
}
.slider img:nth-child(2) {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-ms-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
}
.slider img:nth-child(1) {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-ms-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
}
<div class="slider">
<img class='photo' src="http://farm9.staticflickr.com/8241/8562523343_9bb49b7b7b.jpg" alt="" />
<img class='photo' src="http://farm9.staticflickr.com/8320/8035372009_7075c719d9.jpg" alt="" />
<img class='photo' src="http://farm9.staticflickr.com/8465/8113424031_72048dd887.jpg" alt="" />
<img class='photo' src="http://farm9.staticflickr.com/8465/8113424031_72048dd887.jpg" alt="" />
</div>
It looks like your keyframe is only targeting webkit browsers. Try this:
/* Chrome, Safari, Opera */
#-webkit-keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
/* Standard syntax */
#keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
Also your CSS
.photo {
position: absolute;
-webkit-animation: round 16s infinite;
-ms-animation: round 16s infinite;
animation: round 16s infinite;
opacity: 0;
width: 100%;
}
Forked Copy
Could it be that you are using a webkit prefix? Add this:
-webkit-animation: round 16s infinite;
animation: round 16s infinite;
Possible solution for css animation problems in IE.
I made a css image slider and it worked fine in all browser except IE. I tried all suggestion found on the web but no one worked. Finaly I stripped down the whole page and eventually found that it only worked in IE with an inline style in the header. (i.e. IE11 on windows 7, haven't tested the other IE versions yet)
I have a full page image slideshow on the landing page with an href link on each image.
(http://shawsoofi.com/withinroots/)
The problem is the images all direct to the same link for some reason. I can't figure out why.
HTML:
<ul class="cb-slideshow">
<li><span>Image 01</span></li>
<li><span>Image 02</span></li>
<li><span>Image 03</span></li>
<li><span>Image 04</span></li>
<li><span>Image 05</span></li>
<li><span>Image 06</span></li>
</ul>
CSS:
.cb-slideshow,
.cb-slideshow:after {
position: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
z-index: 0;
}
.cb-slideshow li span {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
color: transparent;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
opacity: 0;
z-index: 0;
-webkit-backface-visibility: hidden;
-webkit-animation: imageAnimation 36s linear infinite 0s;
-moz-animation: imageAnimation 36s linear infinite 0s;
-o-animation: imageAnimation 36s linear infinite 0s;
-ms-animation: imageAnimation 36s linear infinite 0s;
animation: imageAnimation 36s linear infinite 0s;
}
.cb-slideshow li div {
z-index: 1000;
position: absolute;
bottom: 30px;
left: 0px;
width: 100%;
text-align: center;
opacity: 0;
color: #fff;
-webkit-animation: titleAnimation 36s linear infinite 0s;
-moz-animation: titleAnimation 36s linear infinite 0s;
-o-animation: titleAnimation 36s linear infinite 0s;
-ms-animation: titleAnimation 36s linear infinite 0s;
animation: titleAnimation 36s linear infinite 0s;
}
.cb-slideshow li div h3 {
font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
font-size: 240px;
padding: 0;
line-height: 200px;
}
.cb-slideshow li:nth-child(1) span {
background-image: url(../photo/sandwaves/5.jpg)
}
.cb-slideshow li:nth-child(2) span {
background-image: url(../photo/gratuit/4.jpg);
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
.cb-slideshow li:nth-child(3) span {
background-position: 50% 75%;
background-image: url(../photo/feet/4.jpg);
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
}
.cb-slideshow li:nth-child(4) span {
background-image: url(../photo/sandwaves/3.jpg);
-webkit-animation-delay: 18s;
-moz-animation-delay: 18s;
-o-animation-delay: 18s;
-ms-animation-delay: 18s;
animation-delay: 18s;
}
.cb-slideshow li:nth-child(5) span {
background-image: url(../photo/gratuit/2.jpg);
-webkit-animation-delay: 24s;
-moz-animation-delay: 24s;
-o-animation-delay: 24s;
-ms-animation-delay: 24s;
animation-delay: 24s;
}
.cb-slideshow li:nth-child(6) span {
background-position: 50% 75%;
background-image: url(../photo/feet/1.jpg);
-webkit-animation-delay: 30s;
-moz-animation-delay: 30s;
-o-animation-delay: 30s;
-ms-animation-delay: 30s;
animation-delay: 30s;
}
.cb-slideshow li:nth-child(2) div {
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
.cb-slideshow li:nth-child(3) div {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
}
.cb-slideshow li:nth-child(4) div {
-webkit-animation-delay: 18s;
-moz-animation-delay: 18s;
-o-animation-delay: 18s;
-ms-animation-delay: 18s;
animation-delay: 18s;
}
.cb-slideshow li:nth-child(5) div {
-webkit-animation-delay: 24s;
-moz-animation-delay: 24s;
-o-animation-delay: 24s;
-ms-animation-delay: 24s;
animation-delay: 24s;
}
.cb-slideshow li:nth-child(6) div {
-webkit-animation-delay: 30s;
-moz-animation-delay: 30s;
-o-animation-delay: 30s;
-ms-animation-delay: 30s;
animation-delay: 30s;
}
/* Animation for the slideshow images */
#-webkit-keyframes imageAnimation {
0% { opacity: 0;
-webkit-animation-timing-function: ease-in; }
8% { opacity: 1;
-webkit-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-moz-keyframes imageAnimation {
0% { opacity: 0;
-moz-animation-timing-function: ease-in; }
8% { opacity: 1;
-moz-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-o-keyframes imageAnimation {
0% { opacity: 0;
-o-animation-timing-function: ease-in; }
8% { opacity: 1;
-o-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-ms-keyframes imageAnimation {
0% { opacity: 0;
-ms-animation-timing-function: ease-in; }
8% { opacity: 1;
-ms-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#keyframes imageAnimation {
0% { opacity: 0;
animation-timing-function: ease-in; }
8% { opacity: 1;
animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
You have 6 overlapping <span>s, so the last one is in front, blocking all the others. Changing opacity doesn't change whether they block each other. The elements are still there.