CSS animation working everywhere but not in IE and edge? - css

All is in the title, I cannot figure out why my animation is working everywhere but not in IE and edge. Where am I missing something ?
Here are the keyframes of my animation and the JS fiddle associated
$(document).ready(function () {
$('#toggle').hide();
});
$('#toggler').click(function () {
$("#toggle").delay(800).velocity("slideDown", {
duration: 1200
});
$("#footer").delay(800).velocity("scroll", {
duration: 1200
});
});
body {
overflow-x:hidden;
overflow-y:scroll;
}
#content1 {
width:100%;
height:800px;
background-color:grey;
position:relative;
}
#toggler {
position: absolute;
left: 0;
right: 0;
bottom:10px;
margin-left: auto;
margin-right: auto;
width: 100px;
height:50px;
}
#footer {
background-color:black;
width:100%;
height:150px;
}
.slide-up {
display: block;
height: auto;
width:100%;
}
.animate {
animation: super-zgeger-mob 5s;
animation-timing-function: linear;
animation-iteration-count: 1;
transform-origin: 50% 50%;
z-index: 9999;
overflow: hidden;
-webkit-animation: super-zgeger-mob linear 5s;
-webkit-animation-iteration-count: 1;
-webkit-transform-origin: 50% 50%;
-webkit-animation-fill-mode: forwards;
-moz-animation: super-zgeger-mob linear 5s;
-moz-animation-iteration-count: 1;
-moz-transform-origin: 50% 50%;
-moz-animation-fill-mode: forwards;
-o-animation: super-zgeger-mob linear 5s;
-o-animation-iteration-count: 1;
-o-transform-origin: 50% 50%;
-o-animation-fill-mode: forwards;
-ms-animation: super-zgeger-mob linear 5s;
-ms-animation-iteration-count: 1;
-ms-transform-origin: 50% 50%;
-ms-animation-fill-mode: forwards;
}
#keyframes super-zgeger-mob {
0% {
transform: translate(-90%, 0%);
opacity: 0;
}
15% {
transform: translate(-90%, 0%);
opacity: 1;
}
50% {
transform: translate(0%, 0%);
}
75% {
transform: translate(-5%, 0%) rotate(10deg);
}
100% {
transform: translate(150%, 0%);
}
}
#-moz-keyframes super-zgeger-mob {
0% {
-moz-transform: translate(-90%, 0%);
opacity: 0;
}
15% {
-moz-transform: translate(-90%, 0%);
opacity: 1;
}
50% {
-moz-transform: translate(0%, 0%);
}
75% {
-moz-transform: translate(-5%, 0%) rotate(10deg);
}
100% {
-moz-transform: translate(150%, 0%);
}
}
#-webkit-keyframes super-zgeger-mob {
0% {
-webkit-transform: translate(-90%, 0%);
opacity: 0;
}
15% {
-webkit-transform: translate(-90%, 0%);
opacity: 1;
}
50% {
-webkit-transform: translate(0%, 0%);
}
75% {
-webkit-transform: translate(-5%, 0%) rotate(10deg);
}
100% {
-webkit-transform: translate(150%, 0%);
}
}
#-o-keyframes super-zgeger-mob {
0% {
-o-transform: translate(-90%, 0%);
opacity: 0;
}
15% {
-o-transform: translate(-90%, 0%);
opacity: 1;
}
50% {
-o-transform: translate(0%, 0%);
}
75% {
-o-transform: translate(-5%, 0%) rotate(10deg);
}
100% {
-o-transform: translate(150%, 0%);
}
}
#-ms-keyframes super-zgeger-mob {
0% {
-ms-transform: translate(-90%, 0%);
opacity: 0;
}
15% {
-ms-transform: translate(-90%, 0%);
opacity: 1;
}
50% {
-ms-transform: translate(0%, 0%);
}
75% {
-ms-transform: translate(-5%, 0%) rotate(10deg);
}
100% {
-ms-transform: translate(150%, 0%);
}
}
<div id=content1>
<button id="toggler">
push me
</button>
</div>
<div id="toggle">
<div id="animation" style="position: relative; left: 0; top: 0;">
<img src="http://image.gilawhost.com/16/11/09/jzjhk7o0.png" class="slide-up"/>
<img id="rolling" src="http://image.gilawhost.com/16/11/09/6d7tsk5k.png" class="slide-up animate" style="position: absolute; top: 0%; left: 0%; z-index: 99;" />
</div>
</div>
<div id=footer>
</div>

I guess, Using positioning on .animate (left:-90% to desired position) over translate() property will work for you.
translate partially supported by IE 11 only and in opera its also wont work properly.
http://caniuse.com/#feat=transforms2d.

Related

There is css animation which named 'for_box2' does not work correnctly

How you see in code my span after 'opacity:0 and rotate()' goes up, then it have to 'scale and opacity: 0' and after that go to down. But it does not goes like that, it quickly before 'scale and opacity' goes down.
Just look at how it works
I don't have many experience with animations but I can not understand, that code have to work properly. But it lose its direction
The link in my commentary
#keyframes for_box2 {
0% {
opacity: 1;
}
3% {
opacity: .5;
}
5% {
opacity: .2;
transform: rotateY(90deg);
}
8% {
opacity: 0;
transform: rotateY(180deg);
}
10% {
transform: translateY(-50%);
}
12% {
transform: translateY(-100%);
}
14% {
transform: translateY(-150%);
}
16% {
transform: translateY(-200%);
}
18% {
transform: scale(.95);
}
20% {
transform: scale(1);
}
22% {
transform: scale(1.25);
}
24% {
transform: scale(1.1);
}
26% {
transform: scale(1);
opacity: .8;
}
28% {
opacity: .5;
transform: rotateY(90deg);
}
30% {
opacity: .2;
transform: rotateY(120deg)
}
32% {
opacity: 0;
transform: rotateY(180deg)
}
40% {
animation-timing-function: ease-out;
transform: translateX(-50%);
transform: rotateY(180deg);
}
48% {
transform: translateX(-120%);
}
56% {
opacity: 1;
transform: rotateY(0deg);
}
64% {
opacity: 0;
transform: rotateY(180deg);
}
72% {
transform: translateY(-200%);
animation-timing-function: cubic-bezier(.01,1.42,.02,1);
}
80% {
opacity: 1;
transform: rotateY(0deg);
}
88% {
opacity: 0;
transform: rotateY(180deg);
}
94% {
transform: translateY(0);
animation-timing-function: cubic-bezier(.01,1.42,.02,1);
}
100% {
transform: rotateY(0deg);
opacity: 1;
}
}
https://codepen.io/babken-asryan/pen/XvbdXB
You need to put all the transformation in the same transform or you will simply override them:
body {
margin: 0;
position: relative;
overflow-x: hidden;
box-sizing: border-box;
}
.wrapper {
transition: .7s;
border: solid #357ae8;
transform: rotate(-.5deg);
padding: 0 !important;
}
.wrapper .inside {
background: linear-gradient(288deg, rgba(233, 26, 93, 0.8883928571428571) 0%, rgba(255, 241, 29, 0.9220063025210083) 36%, rgba(231, 235, 70, 1) 51%, rgba(255, 247, 117, 1) 68%, rgba(156, 233, 247, 0.9472163865546218) 91%);
border: solid #357ae8;
background-size: 400% 400%;
transform: rotate(.5deg);
display: block;
width: 350px;
height: 500px;
animation: Gradient 15s ease infinite;
}
.wrapper .inside span {
display: block;
width: 40%;
height: 30%;
position: absolute;
}
.wrapper .inside span.box2 {
bottom: 5%;
right: 5%;
background: url('https://svgur.com/i/EAo.svg') no-repeat;
-webkit-background-size: cover;
background-size: cover;
background-position: center;
animation: for_box2 linear 45s 1s infinite;
}
#keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
#keyframes for_box2 {
0% {
opacity: 1;
}
3% {
opacity: .5;
}
5% {
opacity: .2;
transform: translateX(0) translateY(0) rotateY(90deg);
}
8% {
opacity: 0;
transform: translateX(0) translateY(0) rotateY(180deg);
}
10% {
transform: translateX(0) translateY(-50%) rotateY(180deg);
}
12% {
transform: translateX(0) translateY(-100%) rotateY(180deg);
}
14% {
transform: translateX(0) translateY(-150%) rotateY(180deg);
}
16% {
transform: translateX(0)translateY(-200%) rotateY(180deg);
}
18% {
transform: translateX(0) translateY(-200%) rotateY(180deg) scale(.95);
}
20% {
transform: translateX(0) translateY(-200%) rotateY(180deg) scale(1);
}
22% {
transform: translateX(0) translateY(-200%) rotateY(180deg) scale(1.25);
}
24% {
transform: translateX(0) translateY(-200%) rotateY(180deg) scale(1.1);
}
26% {
transform: translateX(0) translateY(-200%) rotateY(180deg) scale(1);
opacity: .8;
}
28% {
opacity: .5;
transform: translateX(0) translateY(-200%) rotateY(90deg);
}
30% {
opacity: .2;
transform: translateX(0) translateY(-200%) rotateY(120deg);
}
32% {
opacity: 0;
transform: translateX(0) translateY(-200%)rotateY(180deg);
}
40% {
animation-timing-function: ease-out;
transform: translateX(-50%) translateY(-200%) rotateY(180deg);
}
48% {
transform: translateX(-120%) translateY(-200%) rotateY(180deg);
}
56% {
opacity: 1;
transform: translateX(-120%) translateY(-200%) rotateY(0deg);
}
64% {
opacity: 0;
transform: translateX(-120%) translateY(-200%) rotateY(180deg);
}
72% {
transform: translateX(-120%) translateY(-200%) rotateY(180deg);
animation-timing-function: cubic-bezier(.01, 1.42, .02, 1);
}
80% {
opacity: 1;
transform: translateX(-120%) translateY(-200%) rotateY(0deg);
}
88% {
opacity: 0;
transform: translateX(-120%) translateY(-200%) rotateY(180deg);
}
94% {
transform: translateX(-120%) translateY(0) rotateY(180deg);
animation-timing-function: cubic-bezier(.01, 1.42, .02, 1);
}
100% {
transform: translateX(-120%) translateY(0) rotateY(0deg);
opacity: 1;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<body>
<div class="container-fluid mt-5">
<div class="row d-flex justify-content-around">
<div class="d-inline-flex p-2 wrapper">
<div class="d-inline-flex p-2 inside">
<span class="box2"></span>
</div>
</div>
</div>

Add two more items to animated slider

I am using a CSS3 text slider that was made for 3 lines of text. I wish to add two more lines but cannot figure out how to recalculate keyframes.
I added the additional items in CSS, but do not know how to recalculate the keyframes.
Any help is greatly appreciated!
HTML:
<p class="item-1">Text Line 1</p>
<p class="item-2">Text Line 2</p>
<p class="item-3">Text Line 3</p>
<p class="item-4">Text Line 4</p>
<p class="item-5">Text Line 5</p>
CSS:
.item-1,
.item-2,
.item-3,
.item-4,
.item-5 {
font-family: 'Suez One';
font-size: 72px;
line-height: 80px;
color: white !important;
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: black;
text-shadow: 8px 8px 3px #000000;
position: absolute;
display: block;
width: 60%;
z-index: 1001;
-webkit-animation-duration: 20s;
animation-duration: 20s;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.item-1{
-webkit-animation-name: anim-1;
animation-name: anim-1;
}
.item-2{
-webkit-animation-name: anim-2;
animation-name: anim-2;
}
.item-3{
-webkit-animation-name: anim-3;
animation-name: anim-3;
}
.item-4{
-webkit-animation-name: anim-4;
animation-name: anim-4;
}
.item-5{
-webkit-animation-name: anim-5;
animation-name: anim-5;
}
#-webkit-keyframes anim-1 {
0%, 8.3% { left: -100%; opacity: 0; }
8.3%, 25% { left: 25%; opacity: 1; }
33.33%, 100% { left: 110%; opacity: 0; }
}
#keyframes anim-1 {
0%, 8.3% { left: -100%; opacity: 0; }
8.3%,25% { left: 25%; opacity: 1; }
33.33%, 100% { left: 110%; opacity: 0; }
}
#-webkit-keyframes anim-2 {
0%, 33.33% { left: -100%; opacity: 0; }
41.63%, 58.29% { left: 25%; opacity: 1; }
66.66%, 100% { left: 110%; opacity: 0; }
}
#keyframes anim-2 {
0%, 33.33% { left: -100%; opacity: 0; }
41.63%, 58.29% { left: 25%; opacity: 1; }
66.66%, 100% { left: 110%; opacity: 0; }
}
#-webkit-keyframes anim-3 {
0%, 66.66% { left: -100%; opacity: 0; }
74.96%, 91.62% { left: 25%; opacity: 1; }
100% { left: 110%; opacity: 0; }
}
#keyframes anim-3 {
0%, 66.66% { left: -100%; opacity: 0; }
74.96%, 91.62% { left: 25%; opacity: 1; }
100% { left: 110%; opacity: 0; }
}
#-webkit-keyframes anim-4 {
0%, 66.66% { left: -100%; opacity: 0; }
74.96%, 91.62% { left: 25%; opacity: 1; }
100% { left: 110%; opacity: 0; }
}
#keyframes anim-4 {
0%, 66.66% { left: -100%; opacity: 0; }
74.96%, 91.62% { left: 25%; opacity: 1; }
100% { left: 110%; opacity: 0; }
}
#-webkit-keyframes anim-5 {
0%, 66.66% { left: -100%; opacity: 0; }
74.96%, 91.62% { left: 25%; opacity: 1; }
100% { left: 110%; opacity: 0; }
}
#keyframes anim-5 {
0%, 66.66% { left: -100%; opacity: 0; }
74.96%, 91.62% { left: 25%; opacity: 1; }
100% { left: 110%; opacity: 0; }
}
When posting this question I got an error message "It looks like your post is mostly code, please add more details" That's why I am typing this. Trying to have some more words so it will let me post this question. Thanks for your patience.
Here's a script that writes the animation on the fly, based on number of slides:
'use strict';
var slider = document.querySelector('.css-slider'),
slides = slider.querySelectorAll('p'),
css = '';
for (var i = 0; i < slides.length; i++) {
css += '.css-slider>*:nth-child(' + (i + 1) + '){animation-name:a-' + i + '}' + ('#keyframes a-' + i + '{') + ('0%,' + i * 100 / slides.length + '%{transform: translatex(-100%)}') + (i * 100 / slides.length + 25 / slides.length + '%,' + ((i + 1) * 100 / slides.length - 25 / slides.length) + '%{transform: translatex(0)}') + ((i + 1) * 100 / slides.length + '%,100%{transform: translatex(100%)}') + '}';
}
css += '.css-slider>*{animation-duration:' + slides.length * 4 + 's;';
var head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
#import url('https://fonts.googleapis.com/css?family=Suez+One');
.css-slider > * {
font-family: 'Suez One';
font-size: 72px;
line-height: 55px;
color: white;
text-shadow: 5px 5px 3px rgba(0,0,0,.65);
position: absolute;
top: 0;
width: 100%;
text-align: center;
animation-timing-function: cubic-bezier(.4,0,.2,1);
animation-iteration-count: infinite;
}
.css-slider, .css-slider > *:last-child {
position: relative;
}
.css-slider {
display: flex;
align-items: center;
justify-content: center;
}
body {
margin: 0;
overflow-x: hidden;
}
<div class="css-slider">
<p>Text Line 1</p>
<p>Text Line 2</p>
<p>Text Line 3</p>
<p>Text Line 4</p>
<p>Text Line 5</p>
<p>Text Line 6</p>
<p>Text Line 7</p>
</div>
Note I changed your initial markup, as I wanted it to write a more general solution, not one tailored to your particular case.
But if you're only interested in the CSS for 5 items and you want to keep your markup here's what you're asking for:
.item-1 { -webkit-animation-name: a-0; animation-name: a-0 }
.item-2 { -webkit-animation-name: a-1; animation-name: a-1 }
.item-3 { -webkit-animation-name: a-2; animation-name: a-2 }
.item-4 { -webkit-animation-name: a-3; animation-name: a-3 }
.item-5 { -webkit-animation-name: a-4; animation-name: a-4 }
#-webkit-keyframes a-0 {
0% { -webkit-transform: translatex(-100%); transform: translatex(-100%) }
5%, 15% { -webkit-transform: translatex(0); transform: translatex(0) }
20%, 100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#keyframes a-0 {
0% { -webkit-transform: translatex(-100%); transform: translatex(-100%) }
5%, 15% { -webkit-transform: translatex(0); transform: translatex(0) }
20%, 100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#-webkit-keyframes a-1 {
0%, 20% { -webkit-transform: translatex(-100%); transform: translatex(-100%)}
25%, 35% { -webkit-transform: translatex(0); transform: translatex(0) }
40%, 100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#keyframes a-1 {
0%, 20% { -webkit-transform: translatex(-100%); transform: translatex(-100%)}
25%, 35% { -webkit-transform: translatex(0); transform: translatex(0) }
40%, 100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#-webkit-keyframes a-2 {
0%, 40% { -webkit-transform: translatex(-100%); transform: translatex(-100%) }
45%, 55% { -webkit-transform: translatex(0); transform: translatex(0) }
60%, 100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#keyframes a-2 {
0%, 40% { -webkit-transform: translatex(-100%); transform: translatex(-100%) }
45%, 55% { -webkit-transform: translatex(0); transform: translatex(0) }
60%, 100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#-webkit-keyframes a-3 {
0%, 60% { -webkit-transform: translatex(-100%); transform: translatex(-100%) }
65%, 75% { -webkit-transform: translatex(0); transform: translatex(0) }
80%, 100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#keyframes a-3 {
0%, 60% { -webkit-transform: translatex(-100%); transform: translatex(-100%) }
65%, 75% { -webkit-transform: translatex(0); transform: translatex(0) }
80%, 100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#-webkit-keyframes a-4 {
0%, 80% { -webkit-transform: translatex(-100%); transform: translatex(-100%) }
85%, 95% { -webkit-transform: translatex(0); transform: translatex(0) }
100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
#keyframes a-4 {
0%, 80% { -webkit-transform: translatex(-100%); transform: translatex(-100%) }
85%, 95% { -webkit-transform: translatex(0); transform: translatex(0) }
100% { -webkit-transform: translatex(100%); transform: translatex(100%) }
}
And the principle behind the keyframes is:
.item-${n+1} { animation-name: a-${n} }
#keyframes a-${n} {
0%, enterStart { left state ruleset }
enterEnd, leaveStart { center state ruleset }
leaveEnd, 100% { right state ruleset }
}

css3 pulse effect delay

Hello I have a button that pulses in css3 (works great) what I want it to do is pulse every 12sec...how can I do this?
.pulse {
animation-name: pulse_animation;
animation-duration: 10000ms;
transform-origin:70% 70%;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
#keyframes pulse_animation {
0% { transform: scale(1); }
30% { transform: scale(1); }
40% { transform: scale(1.08); }
50% { transform: scale(1); }
60% { transform: scale(1); }
70% { transform: scale(1.05); }
80% { transform: scale(1); }
100% { transform: scale(1); }
}
I have set the duration to 3sec to let you see exactly how does it work. You can freely adjust the duration by urself. Just change 3s into 12s.
https://jsfiddle.net/bL164jj8/
.pulse {
animation-name: pulse_animation;
animation-duration: 3s;
transform-origin: 70% 70%;
animation-iteration-count: infinite;
animation-timing-function: linear;
height: 100px;
width: 100px;
background-color: lightblue;
}
#keyframes pulse_animation {
0% {
transform: scale(1);
}
8% {
transform: scale(1.01);
}
16% {
transform: scale(1.02);
}
24% {
transform: scale(1.03);
}
32% {
transform: scale(1.04);
}
40% {
transform: scale(1.05);
}
50% {
transform: scale(1.06);
}
58% {
transform: scale(1.05);
}
66% {
transform: scale(1.04);
}
74% {
transform: scale(1.03);
}
82% {
transform: scale(1.02);
}
90% {
transform: scale(1.01);
}
100% {
transform: scale(1);
}
}
<div class='pulse'>
</div>

Animating arrows using CSS3 to provide a cyclic movement effect

I have tried to make an animated arrow like like the one in this site. A demo of my code attempt is available here. But the animation is not working in-line with the animation in the site.
My Code :
.animated-arrow-1 {
-webkit-animation: arrow1 3s infinite ease-out;
animation: arrow1 3s infinite ease-out;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0
}
.animated-arrow-2 {
-webkit-animation: arrow2 3s infinite ease-in;
animation: arrow2 3s infinite ease-in;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
opacity: 1
}
#-webkit-keyframes arrow1 {
0% {
opacity: 0;
-webkit-transform: translate(0,0);
transform: translate(0,0)
}
90% {
opacity: 0;
-webkit-transform: translate(0,0);
transform: translate(0,0)
}
100% {
opacity: 1;
-webkit-transform: translate(0,36px);
transform: translate(0,36px)
}
}
#keyframes arrow1 {
0% {
opacity: 0;
-webkit-transform: translate(0,0);
-ms-transform: translate(0,0);
transform: translate(0,0)
}
90% {
opacity: 0;
-webkit-transform: translate(0,0);
-ms-transform: translate(0,0);
transform: translate(0,0)
}
100% {
opacity: 1;
-webkit-transform: translate(0,36px);
-ms-transform: translate(0,36px);
transform: translate(0,36px)
}
}
#-webkit-keyframes arrow2 {
0% {
opacity: 1;
-webkit-transform: translate(0,0);
transform: translate(0,0)
}
90% {
opacity: 1;
-webkit-transform: translate(0,0);
transform: translate(0,0)
}
100% {
opacity: 0;
-webkit-transform: translate(0,36px);
transform: translate(0,36px)
}
}
#keyframes arrow2 {
0% {
opacity: 1;
-webkit-transform: translate(0,0);
-ms-transform: translate(0,0);
transform: translate(0,0)
}
90% {
opacity: 1;
-webkit-transform: translate(0,0);
-ms-transform: translate(0,0);
transform: translate(0,0)
}
100% {
opacity: 0;
-webkit-transform: translate(0,36px);
-ms-transform: translate(0,36px);
transform: translate(0,36px)
}
}
Could you please anybody tell me what I missed here?
You were reasonably close to achieving the required animation. In your code, there was only one movement from 0px to 36px for both the arrows but what was actually needed is a two stage animation with different keyframe settings for the two arrows. One arrow should start invisible at 0px, fade-in to 50px, stay there and then fade-out to 100px whereas the other arrow should start visible at 50px, fade-out to 100px, immediately go to 0px and then fade-in at 50px.
.icon {
position: relative;
}
.icon img {
position: absolute;
margin: auto;
display: block;
}
.animated-arrow-1 {
animation: arrow1 3s infinite linear;
opacity: 0
}
.animated-arrow-2 {
animation: arrow2 3s infinite linear;
opacity: 1;
}
#keyframes arrow1 {
0%, 10% {
opacity: 0;
transform: translate(0, 0px);
}
50%,
60% {
opacity: 1;
transform: translate(0, 50px)
}
100% {
opacity: 0;
transform: translate(0, 100px)
}
}
#keyframes arrow2 {
0%, 10% {
opacity: 1;
transform: translate(0, 50px);
}
50%,
60% {
opacity: 0;
transform: translate(0, 100px)
}
61% {
opacity: 0;
transform: translate(0, 0);
}
100% {
opacity: 1;
transform: translate(0, 50px)
}
}
body {
background: #000;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class="icon">
<img src="http://s12.postimg.org/ibsmfp6w9/Down_Arrow.png" class="animated-arrow-1" />
<img src="http://s12.postimg.org/ibsmfp6w9/Down_Arrow.png" class="animated-arrow-2" />
</div>

Disable css animation on page load

I want to disable css animation on page load only.
The thing is that this css animation is the menu icon of main navigation menu, but when on subpages (where there also is a submenu present) on click on submenu the main menu animation activates - but i would like it to only start when my main navigation icon is clicked. I provided html, javascript and css involved.
I would appreciate your support in this.
html:
<div class="mcwrap">
<input id="click" name="exit" type="checkbox">
<label for="click"><span class="burger"></span></label>
</div>
javascript:
$('.mcwrap label').on('click', function(){
(!$('#click').prop('checked')) ? setTimeout(function(){opensLeft()}, 200) : setTimeout(function(){closesLeft()}, 200);
});
function opensLeft() {
$("#sl").addClass('visible')
$("#swipe").addClass('isOpenLeft');
}
function closesLeft() {
$("#sl").removeClass('visible')
$("#swipe").removeClass('isOpenLeft');
}
css:
#sl.visible, #sr.visible {
display: block;
}
.mcwrap {
padding-top: 9px;
}
.mcwrap input {
display: none;
}
.mcwrap label {
position: relative;
width: 20px;
height: 30px;
display: block;
cursor: pointer;
background: transparent;
}
/* Exit Icon */
.mcwrap label:before,
.mcwrap input:checked + label:before {
content: '';
position: absolute;
top: 50%;
margin-top: -2px;
width: 30px;
height: 4px;
border-radius: 2px;
background: #fafafa;
}
.mcwrap label:before {
-webkit-animation: animationOneReverse 1s ease forwards;
animation: animationOneReverse 1s ease forwards;
}
#-webkit-keyframes animationOneReverse {
0% {
-webkit-transform: rotate(315deg);
}
25% {
-webkit-transform: rotate(360deg);
}
50%,
100% {
-webkit-transform: rotate(0deg);
}
}
#keyframes animationOneReverse {
0% {
transform: rotate(315deg);
}
25% {
transform: rotate(360deg);
}
50%,
100% {
transform: rotate(0deg);
}
}
.mcwrap input:checked + label:before {
-webkit-animation: animationOne 1s ease forwards;
animation: animationOne 1s ease forwards;
}
#-webkit-keyframes animationOne {
0%,
50% {
-webkit-transform: rotate(0deg);
}
75% {
-webkit-transform: rotate(360deg);
}
100% {
-webkit-transform: rotate(315deg);
}
}
#keyframes animationOne {
0%,
50% {
transform: rotate(0deg);
}
75% {
transform: rotate(360deg);
}
100% {
transform: rotate(315deg);
}
}
.mcwrap label:after,
.mcwrap input:checked + label:after {
content: '';
position: absolute;
top: 50%;
margin-top: -2px;
width: 30px;
height: 4px;
border-radius: 2px;
background: #fafafa;
}
.mcwrap label:after {
-webkit-animation: animationTwoReverse 1s ease forwards;
animation: animationTwoReverse 1 s ease forwards;
}
#-webkit-keyframes animationTwoReverse {
0% {
-webkit-transform: rotate(405deg);
}
25% {
-webkit-transform: rotate(450deg);
}
50%,
100% {
-webkit-transform: rotate(0deg);
}
}
#keyframes animationTwoReverse {
0% {
transform: rotate(405deg);
}
25% {
transform: rotate(450deg);
}
50%,
100% {
transform: rotate(0deg);
}
}
.mcwrap input:checked + label:after {
-webkit-animation: animationTwo 1s ease forwards;
animation: animationTwo 1s ease forwards;
}
#-webkit-keyframes animationTwo {
0%,
50% {
-webkit-transform: rotate(0deg);
}
75% {
-webkit-transform: rotate(450deg);
}
100% {
-webkit-transform: rotate(405deg);
}
}
#keyframes animationTwo {
0%,
50% {
transform: rotate(0deg);
}
75% {
transform: rotate(450deg);
}
100% {
transform: rotate(405deg);
}
}
/* Burger Icon */
.mcwrap label .burger:before {
content: '';
position: absolute;
top: 4px;
width: 30px;
height: 4px;
border-radius: 2px;
background: #fafafa;
-webkit-animation: animationBurgerTopReverse 1s ease forwards;
animation: animationBurgerTopReverse 1s ease forwards;
}
#-webkit-keyframes animationBurgerTopReverse {
0%,
50% {
-webkit-transform: translateY(12px);
opacity: 0;
}
51% {
-webkit-transform: translateY(12px);
opacity: 1;
}
100% {
-webkit-transform: translateY(0px);
opacity: 1;
}
}
#keyframes animationBurgerTopReverse {
0%,
50% {
transform: translateY(12px);
opacity: 0;
}
51% {
transform: translateY(12px);
opacity: 1;
}
100% {
transform: translateY(0px);
opacity: 1;
}
}
.mcwrap input:checked + label .burger:before {
-webkit-animation: animationBurgerTop 1s ease forwards;
animation: animationBurgerTop 1s ease forwards;
}
#-webkit-keyframes animationBurgerTop {
0% {
-webkit-transform: translateY(0px);
opacity: 1;
}
50% {
-webkit-transform: translateY(12px);
opacity: 1;
}
51%,
100% {
-webkit-transform: translateY(12px);
opacity: 0;
}
}
#keyframes animationBurgerTop {
0% {
transform: translateY(0px);
opacity: 1;
}
50% {
transform: translateY(12px);
opacity: 1;
}
51%,
100% {
transform: translateY(12px);
opacity: 0;
}
}
.mcwrap label .burger:after {
content: '';
position: absolute;
bottom: 4px;
width: 30px;
height: 4px;
border-radius: 2px;
background: #fafafa;
-webkit-animation: animationBurgerBottomReverse 1s ease forwards;
animation: animationBurgerBottomReverse 1s ease forwards;
}
#-webkit-keyframes animationBurgerBottomReverse {
0%,
50% {
-webkit-transform: translateY(-12px);
opacity: 0;
}
51% {
-webkit-transform: translateY(-12px);
opacity: 1;
}
100% {
-webkit-transform: translateY(0px);
opacity: 1;
}
}
#keyframes animationBurgerBottomReverse {
0%,
50% {
transform: translateY(-12px);
opacity: 0;
}
51% {
transform: translateY(-12px);
opacity: 1;
}
100% {
transform: translateY(0px);
opacity: 1;
}
}
.mcwrap input:checked + label .burger:after {
-webkit-animation: animationBurgerBottom 1s ease forwards;
animation: animationBurgerBottom 1s ease forwards;
}
#-webkit-keyframes animationBurgerBottom {
0% {
-webkit-transform: translateY(0px);
opacity: 1;
}
50% {
-webkit-transform: translateY(-12px);
opacity: 1;
}
51%,
100% {
-webkit-transform: translateY(-12px);
opacity: 0;
}
}
#keyframes animationBurgerBottom {
0% {
transform: translateY(0px);
opacity: 1;
}
50% {
transform: translateY(-12px);
opacity: 1;
}
51%,
100% {
transform: translateY(-12px);
opacity: 0;
}
}
Add in JS a class when document is loaded:
$(window).on('load', function(){
$('body').addClass('loaded')
});
Then in CSS:
.loaded .mcwrap label:before {
-webkit-animation: animationOneReverse 1s ease forwards;
animation: animationOneReverse 1s ease forwards;
}
Repeat this example for every animation that need the load event

Resources