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
Related
The boxes are stacked on top of each other using the position: absolute property. When you hover over the container they should rotate with a delay between and have the border turn orange to create some sort of effect.
They aren't moving at all however.
.main-animation-box {
border: solid orange;
height: 30vh;
width: 16vw;
position: absolute;
}
.email-sub-box:hover .main-animation-box-1 {
animation: box-rotate;
animation-iteration-count: infinite;
animation-timing-function: 5s;
animation-delay: 0s;
}
.email-sub-box:hover .main-animation-box-2 {
animation: box-rotate;
animation-iteration-count: infinite;
animation-timing-function: 5s;
animation-delay: 1s;
}
.email-sub-box:hover .main-animation-box-3 {
animation: box-rotate;
animation-iteration-count: infinite;
animation-timing-function: 5s;
animation-delay: 1.5s;
}
.email-sub-box:hover .main-animation-box-4 {
animation: box-rotate;
animation-iteration-count: infinite;
animation-timing-function: 5s;
animation-delay: 2s;
}
.email-sub-box:hover .main-animation-box-5 {
animation: box-rotate;
animation-iteration-count: infinite;
animation-timing-function: 5s;
animation-delay: 2.5s;
}
#keyframes box-rotate {
10% {
border: solid orange;
}
50% {
transform: rotateY(720deg);
}
}
<div class="email-sub-box email-left">
<div class="main-animation-box main-animation-box-1"></div>
<div class="main-animation-box main-animation-box-2"></div>
<div class="main-animation-box main-animation-box-3"></div>
<div class="main-animation-box main-animation-box-4"></div>
<div class="main-animation-box main-animation-box-5"></div>
</div>
i have changed animation: box-rotate; to animation-name: box-rotate; and animation-timing-function: 5s; to animation-timing-function: ease-out;
.main-animation-box {
border: solid orange;
height: 30vh;
width: 16vw;
position: absolute
}
.email-sub-box:hover .main-animation-box-1 {
animation-name: box-rotate;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-out;
animation-fill-mode: forwards;
animation-delay: 2s;
}
.email-sub-box:hover .main-animation-box-2 {
animation-name: box-rotate;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-out;
animation-fill-mode: forwards;
animation-delay: 1s;
}
.email-sub-box:hover .main-animation-box-3 {
animation-name: box-rotate;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-out;
animation-fill-mode: forwards;
animation-delay: 1.5s;
}
.email-sub-box:hover .main-animation-box-4 {
animation-name: box-rotate;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-out;
animation-fill-mode: forwards;
animation-delay: 2s;
}
.email-sub-box:hover .main-animation-box-5 {
animation-name: box-rotate;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-out;
animation-fill-mode: forwards;
animation-delay: 2.5s;
}
#keyframes box-rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
<div class = "email-sub-box email-left">
<div class="main-animation-box main-animation-box-1"></div>
<div class="main-animation-box main-animation-box-2"></div>
<div class="main-animation-box main-animation-box-3"></div>
<div class="main-animation-box main-animation-box-4"></div>
<div class="main-animation-box main-animation-box-5"></div>
</div>
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 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'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
Animations not working on firefox but working on chrome and IE. please help Keyframe rules are set for moz #-moz-keyframes cf4FadeInOut the problem is that all keyframes rules are set for webkit moz and -o- but still not working.
http://jsfiddle.net/eVULR/1/
/* full image slider */
#-webkit-keyframes cf4FadeInOut {
0% {opacity:1;}
19% {opacity:1;}
25% {opacity:0;}
94% {opacity:0;}
100% {opacity:1;}
}
#-moz-keyframes cf4FadeInOut {
0% {opacity:1;}
19% {opacity:1;}
25% {opacity:0;}
94% {opacity:0;}
100% {opacity:1;}
}
#-o-keyframes cf4FadeInOut {
0% {opacity:1;}
19% {opacity:1;}
25% {opacity:0;}
94% {opacity:0;}
100% {opacity:1;}
}
#keyframes cf4FadeInOut {
0% {opacity:1;}
19% {opacity:1;}
25% {opacity:0;}
94% {opacity:0;}
100% {opacity:1;}
}
#cf4a
{
overflow:hidden;
position: fixed;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background-color:black;
}
#cf4a img
{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 50%;
min-height: 50%;
}
#cf4a img {
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 20s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 20s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 20s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 20s;
}
#page-wrap, #cf4a img:nth-of-type(1) {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
z-index:4;
}
#page-wrap{
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 20s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 20s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 20s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 20s;
-webkit-animation-delay: 3s;
-moz-animation-delay: 3s;
-o-animation-delay: 3s;
animation-delay: 3s;
z-index:5;
}
#page-wrap1,#cf4a img:nth-of-type(2) {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
z-index:3;
}
#page-wrap1{
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 20s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 20s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 20s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 20s;
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
z-index:3;
}
#page-wrap2,#cf4a img:nth-of-type(3) {
-webkit-animation-delay: 8s;
-moz-animation-delay: 8s;
-o-animation-delay: 8s;
animation-delay: 8s;
z-index:2;
}
#page-wrap2{
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 20s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 20s;
-o-animation-name: cf4FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 20s;
animation-name: cf4FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 20s;
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
z-index:2;
}
#page-wrap,#cf4a img:nth-of-type(4) {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
animation-delay: 12s;
z-index:1;
}
I'm sure you would like a pure CSS solution, but that is not possible right now. Many of the browsers still have not gotten up to the new CSS capabilities.
I would suggest jQuery for your solution. There are several functions within the API such as slideIn(), fadeIn(), fadeOut(), .toggle() etc...
Using these functions is as simple as waiting for DOM ready and then applying your class for the effect your looking for. A quick example is below.
<script type="text/javascript">
$(function() {
$(".myButton").hover(function(){
$(this).fadeOut("slow");
});
});//end dom
</script>