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>
Related
I'm trying to add animation to create something like a carousel, but the animation part in my CSS is not working.
div#trustw {
padding: 20px;
}
div#trustc {
height: 38px;
background-image: url(https://siasky.net/CAC--w_DduTHuvdgazKKQ87iMMSysgeoGje9_xsadF_qLw);
background-repeat: repeat-x;
-webkit-animation: animatedBackground 20s linear infinite;
animation: animatedBackground 20s linear infinite;
animation-duration: 20s;
animation-timing-function: linear;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: normal;
animation-fill-mode: none;
animation-play-state: running;
animation-name: animatedBackgroud;
}
<div id="trustw" class="container-fluid">
<div id="trustc" class="container"></div>
</div>
You forgot to define the animation:
#keyframes animatedBackgroud {
from {background-position: 0%;}
to {background-position: 100%;}
}
div#trustw {
padding: 20px;
}
div#trustc {
height: 38px;
background-image: url(https://siasky.net/CAC--w_DduTHuvdgazKKQ87iMMSysgeoGje9_xsadF_qLw);
background-repeat: repeat-x;
-webkit-animation: animatedBackground 20s linear infinite;
animation: animatedBackground 20s linear infinite;
animation-duration: 20s;
animation-timing-function: linear;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: normal;
animation-fill-mode: none;
animation-play-state: running;
animation-name: animatedBackgroud;
}
#keyframes animatedBackgroud {
from {background-position: 0%;}
to {background-position: 100%;}
}
<div id="trustw" class="container-fluid">
<div id="trustc" class="container"></div>
</div>
I'm creating an effect where text slides into the window and stays there after the animation ends. I've been able to get the animation to work on 1 piece of the text, but for some reason the 2nd piece is not working.
Please see my fiddle https://jsfiddle.net/9fpryou8/
Thanks in advance.
figure h2.world {
position: absolute;
top: 20%;
left: 61%;
background-color: transparent;
font-size: 7em;
color: white;
font-family: Paytone One, Verdana, sans-serif;
transform: translateX(300%);
text-shadow: 0px 0px 50px black;
-moz-animation-name: slideWorld;
-moz-animation-iteration-count: 1;
-moz-animation-timing-function: ease-in;
-moz-animation-duration: 0.4s;
-moz-animation-delay: 1.4s;
-moz-animation-fill-mode: forwards;
-webkit-animation-name: slideWorld;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease-in;
-webkit-animation-duration: 0.4s;
-webkit-animation-delay: 1.4s;
-webkit-animation-fill-mode: forwards;
animation-name: slideWorld;
animation-iteration-count: 1.4;
animation-timing-function: ease-in;
animation-duration: 0.4s;
animation-delay: 1.4s;
animation-fill-mode: forwards;
}
In .world, replace
animation-iteration-count: 1.4;
with
animation-iteration-count: 1;
figure {
height: 98vh;
background-color: grey;
}
figure h2.hello {
position: absolute;
top: 20%;
left: 39%;
font-size: 1em;
background-color: transparent;
color: white;
font-family: Paytone One, Verdana, sans-serif;
transform: translateX(-400%);
text-shadow: 0px 0px 50px black;
-moz-animation-name: slideHello;
-moz-animation-iteration-count: 1;
-moz-animation-timing-function: ease-in;
-moz-animation-duration: 0.4s;
-moz-animation-delay: 1s;
-moz-animation-fill-mode: forwards;
-webkit-animation-name: slideHello;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease-in;
-webkit-animation-duration: 0.4s;
-webkit-animation-delay: 1s;
-webkit-animation-fill-mode: forwards;
animation-name: slideHello;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 0.4s;
animation-delay: 1s;
animation-fill-mode: forwards;
}
figure h2.world {
position: absolute;
top: 20%;
left: 61%;
background-color: transparent;
font-size: 1em;
color: white;
font-family: Paytone One, Verdana, sans-serif;
transform: translateX(300%);
text-shadow: 0px 0px 50px black;
-moz-animation-name: slideWorld;
-moz-animation-iteration-count: 1;
-moz-animation-timing-function: ease-in;
-moz-animation-duration: 0.4s;
-moz-animation-delay: 1.4s;
-moz-animation-fill-mode: forwards;
-webkit-animation-name: slideWorld;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease-in;
-webkit-animation-duration: 0.4s;
-webkit-animation-delay: 1.4s;
-webkit-animation-fill-mode: forwards;
animation-name: slideWorld;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 0.4s;
animation-delay: 1.4s;
animation-fill-mode: forwards;
}
/**** Display Hello on Load ****/
#-moz-keyframes slideHello {
to {
-moz-transform: translateX(-39%);
}
}
#-webkit-keyframes slideHello {
to {
-webkit-transform: translateX(-39%);
}
}
#keyframes slideHello {
to {
transform: translateX(-39%);
}
}
/**** Display World on Load ****/
#-moz-keyframes slideWorld {
to {
-moz-transform: translateX(-61%);
}
}
#-webkit-keyframes slideWorld {
to {
-webkit-transform: translateX(-61%);
}
}
#keyframes slideWorld {
to {
transform: translateX(-61%);
}
}
<figure>
<h2 class="hello">Hello</h2>
<h2 class="world">World</h2>
</figure
Or simple delete it: the initial value of animation-iteration-count is 1.
you have a typing mistake
change animation-iteration-count: 1.4; to animation-iteration-count: 1;
then it should work
So what I'm working on is a CSS animation, the nav elements and main logo all drop down from above when the page loads (visit www.joeyorlando.me for a live preview of the current animation).
Everything works great except for the fact that if you were to resize the width of your browser, the media queries break the nav appropriately and hide the main nav to show a hamburger-icon mobile nav (still a work in progress). When you resize the window again and make it larger, the animation restarts.
Is there any way to basically tell the animation that once it plays once, never play again and just hold the state that it ended in? I tried using animation-fill-mode: forwards; and animation-iteration-count: 1; to no avail.
HTML
<header>
<div id="hamburger">
<div></div>
<div></div>
<div></div>
</div>
<div class="logo logo-animated bounceInDown">
<h1>Joey Orlando</h1><br>
<h2>Cancer Researcher | Web Developer</h2>
</div>
<nav class="normalNav" id="normalNav">
<ul>
<li>About</li>
<li>Background</li>
<li>Research</li>
<li>Travels</li>
<li>Contact Me</li>
</ul>
</nav>
CSS Animation
.bounceInDown {
-webkit-animation-name: bounceInDown;
animation-name: bounceInDown;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
animation-iteration-count: 1;
}
.about-animated {
-webkit-animation-duration: 2s;
-webkit-animation-delay: 0s;
animation-delay: 0s;
animation-duration: 2s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
animation-iteration-count: 1;
}
.background-animated {
-webkit-animation-duration: 2s;
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
animation-duration: 2s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
animation-iteration-count: 1;
}
.research-animated {
-webkit-animation-duration: 2s;
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
animation-duration: 2s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
animation-iteration-count: 1;
}
.travels-animated {
-webkit-animation-duration: 2s;
-webkit-animation-delay: 0.9s;
animation-delay: 0.9s;
animation-duration: 2s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
animation-iteration-count: 1;
}
.contact-animated {
-webkit-animation-duration: 2s;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
animation-duration: 2s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
animation-iteration-count: 1;
}
.logo-animated {
-webkit-animation-duration: 2s;
-webkit-animation-delay: 1.5s;
animation-delay: 1.5s;
animation-duration: 2s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
-webkit-animation-iteration-count: 1;
-moz-animation-iteration-count: 1;
animation-iteration-count: 1;
}
/**************************
ANIMATION KEYFRAMES - NAVIGATION
**************************/
#-webkit-keyframes bounceInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateY(30px);
}
80% {
-webkit-transform: translateY(-10px);
}
100% {
-webkit-transform: translateY(0);
}
}
#keyframes bounceInDown {
0% {
opacity: 0;
transform: translateY(-2000px);
}
60% {
opacity: 1;
transform: translateY(30px);
}
80% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}
It may not be the best way (I'm not so familiar with CSS3 animations), but you could use JS to detect CSS animation end events and remove the animation classes or try adding: transition: none to the elements you want to stop.
On page load, use JS to check if a session is set, if it's not run the animation and then set the session. When the statement runs again it will detect the previously set session and not run the animation.
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>
I'm a developer with not much CSS experience. I want to create a pure CSS3 slideshow using two images. I found some nifty code for doing so, and I've implemented a very slight variation below (basically I just took out the #cf3 id selector for img .top):
.slide {
position:absolute;
}
#keyframes cf3FadeInOut {
0% {
opacity:1;
}
45% {
opacity:1;
}
55% {
opacity:0;
}
100% {
opacity:0;
}
}
img.top {
animation-name: cf3FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 10s;
animation-direction: alternate;
}
The first image is defined as <img class="slideshow top" src="img1.jpg">. The second is the same except without the "top" class.
When I load the page, all of my other CSS works, but the animation is nowhere to be found. Anyone see where I went wrong?
You need to add vendor specific property names, CSS3 animation is still a draft spec.
-webkit-animation-name: cf3FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 10s;
-webkit-animation-direction: alternate;
-moz-animation-name: cf3FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-duration: 10s;
-moz-animation-direction: alternate;
-o-animation-name: cf3FadeInOut;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-duration: 10s;
-o-animation-direction: alternate;
animation-name: cf3FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 10s;
animation-direction: alternate;
/* and all the keyframes too */
#-webkit-keyframes cf3FadeInOut { ... }
#-moz-keyframes cf3FadeInOut { ... }
#-o-keyframes cf3FadeInOut { ... }
#keyframes cf3FadeInOut { ... }