I need a side panel that slides in and slides out if the button is clicked. I am trying to write it in pure css.
How can achieve the transition smooth. I tried keyframes and i am not getting the desired result.
Here is my jsFiddle link
Here is my css i played with
.showFlyoutPanel.ng-enter, .showFlyoutPanel.ng-leave {
}
.showFlyoutPanel.ng-enter,
.showFlyoutPanel.ng-leave.ng-leave-active {
-webkit-animation-name: slideOut; /* Chrome, Safari, Opera */
-webkit-animation-duration: 4s; /* Chrome, Safari, Opera */
-webkit-animation-direction: reverse; /* Chrome, Safari, Opera */
animation-name: slideOut;
animation-duration: 4s;
animation-direction: reverse;
}
.showFlyoutPanel.ng-leave,
.showFlyoutPanel.ng-enter.ng-enter-active {
-webkit-animation-name: slideIn; /* Chrome, Safari, Opera */
-webkit-animation-duration: 4s; /* Chrome, Safari, Opera */
-webkit-animation-direction: forwards; /* Chrome, Safari, Opera */
animation-name: slideIn;
animation-duration: 4s;
animation-direction: forwards;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes slideIn {
0% {right:-100px;}
25% {right:-75px;}
50% {right:-50px;}
75% {right:-25px;}
100% {right:0;opacity: 1;}
}
/* Standard syntax */
#keyframes slideIn {
0% {right:-100px;}
25% {right:-75px;}
50% {right:-50px;}
75% {right:-25px;}
100% {right:0;opacity: 1;}
}
/* Chrome, Safari, Opera */
#-webkit-keyframes slideOut {
0% {right:0px;}
25% {right:25%;}
50% {right:50%;}
75% {right:75%;}
100% {right:100%;}
}
/* Standard syntax */
#keyframes slideOut {
0% {right:0px;}
25% {right:25%;}
50% {right:50%;}
75% {right:75%;}
100% {right:100%;}
}
I got the answer with this set of codes. But want to make sure whether the code set is correct. And what is the use of
.showFlyoutPanel.ng-enter, .showFlyoutPanel.ng-leave { }
.showFlyoutPanel.ng-enter, .showFlyoutPanel.ng-leave {
}
.showFlyoutPanel.ng-enter,
.showFlyoutPanel.ng-leave.ng-leave-active {
-webkit-animation-timing-function: ease-in-out;
-webkit-animation: slideOut 5s; /* Chrome, Safari, Opera */
animation: slideOut 5s ;
}
.showFlyoutPanel.ng-leave,
.showFlyoutPanel.ng-enter.ng-enter-active {
-webkit-animation: slideIn 5s; /* Chrome, Safari, Opera */
animation: slideIn 5s ;
-webkit-animation-timing-function: ease-in-out;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes slideIn {
from {left: 100%;}
to {left: 0px;}
}
/* Standard syntax */
#keyframes slideIn {
from {left: 100%;}
to {left: 0px;}
}
/* Chrome, Safari, Opera */
#-webkit-keyframes slideOut {
from {left: 0px;}
to {left: 100%;}
}
/* Standard syntax */
#keyframes slideOut {
from {left: 0px;}
to {left: 100%;}
}
Related
I'm fading in two objects on a very simple page. First the logo, then the text. Why is the animation on the text not delaying with this code? The other one works flawlessly, but it doesn't have any delay.
.centralimg {
background-image: url(logo.png);
background-size: 576px 173px;
width: 576px;
height: 173px;
animation: fadein 1200ms;
-moz-animation: fadein 1200ms; /* Firefox */
-webkit-animation: fadein 1200ms; /* Safari and Chrome */
-o-animation: fadein 1200ms; /* Opera */
}
.centraltext {
color: rgb(147, 145, 147);
font-family: 'Nunito', sans-serif;
font-size: 8pt;
margin-top: 25px;
animation: fadein 1200ms;
animation-delay: 3s;
-moz-animation: fadein 1200ms; /* Firefox */
-moz-animation-delay:3s;
-webkit-animation: fadein 1200ms; /* Safari and Chrome */
-webkit-animation-delay:3s;
-o-animation: fadein 3200ms; /* Opera */
}
Your code is correct, but you must add some property to the .centraltext, because it should not be visible until the animation is applied (opacity: 0 in JSFiddle example).
And also add the property animation-fill-mode to preserve the style of the last frame.
Example: JSFiddle
.centraltext {
...
opacity: 0;
animation-fill-mode: forwards;
}
It will delay two seconds, then start the animation. It can be useful.
-webkit-animation-delay: 2s; /* Safari 4.0 - 8.0 */
animation-delay: 2s;
I have a css keyframe animation, that I want to hide before the animation starts. It is working fine in firefox (40.0.3) but in internet explorer 11 the pictures remain visible until the animation starts.
I followed these tutorials, suggestions
https://graphicfusion.design/blog/design/creating-fancy-css3-fade-in-animations-on-page-load/
and this
Cross-Fade between images with CSS in loop
I have simplified my code, put it all in one sheet, linked in royalty free images and put in three divs to show my confusion.
Am I missing something obvious?
<!-- Internal style sheet -->
<html>
<head>
<style>
/*************************************************/
.Angel03Pink img {
position:absolute;
left:0px;
top:0;
-webkit-animation-name: KEYFRAME_DIRECTIVE_whatItDoes;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 3s;
animation-name: KEYFRAME_DIRECTIVE_whatItDoes;
animation-iteration-count: infinite;
animation-duration: 3s;
max-width:100%;
max-height:100%;
<!--animation-direction: alternate; /* does not seem to like anything that comes after this*/-->
border-style:solid;
border-color: #ff0000 #0000ff;
}
#-webkit-keyframes KEYFRAME_DIRECTIVE_whatItDoes {
from {opacity: 0;}
33% {opacity:0}
66% {opacity: 1;}
99% {opacity: 0;}
to {opacity: 0;}
}
#keyframes KEYFRAME_DIRECTIVE_whatItDoes {
from {opacity: 0;}
33% {opacity:0}
66% {opacity: 1;}
99% {opacity: 0;}
to {opacity: 0;}
}
#f1 {
}
#f2 {
-moz-animation-delay: -1s ; /* Firefox */
-webkit-animation-delay: -1s ; /* Safari and Chrome */
-o-animation-delay: -1s ; /* Opera */
animation-delay: -1s ;
}
#f3 {
-moz-animation-delay: -2s ; /* Firefox */
-webkit-animation-delay: -2s ; /* Safari and Chrome */
-o-animation-delay: -2s ; /* Opera */
animation-delay: -2s ;
}
/*************************************************/
.FloatUP {
animation-delay: 4s;
background-repeat: no-repeat;
height: 500px;
width: 250px;
background-position: 100% 100%;
background-size: 100% 100%;
-webkit-animation-name: FloatUpDirective; /* Chrome, Safari, Opera */
-webkit-animation-duration: 12s; /* Chrome, Safari, Opera */
-webkit-animation-iteration-count: infinite; /* Chrome, Safari, Opera */
animation-name: FloatUpDirective;
animation-duration: 12s;
animation-iteration-count: 1; /*-- can be infinite */
border-style:none;
border-color: orange yellow;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes FloatUpDirective {
0%{-webkit-opacity: 0; -moz-opacity: 0; opacity: 0;}
1% { transform: translateY(300px); }
100% { transform: translateY(0);}
}
/* Standard syntax */
#keyframes FloatUpDirective {
0%{-webkit-opacity: 0; -moz-opacity: 0; opacity: 0;}
1% { transform: translateY(300px); }
100% { transform: translateY(0);}
}
/***********************************/
.common
{
width:100px;
height:100px;
/*background:red;*/
}
/* make keyframes that tell the start state and the end state of our object */
#-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
#-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
#keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.fade-in {
opacity:0; /* make things invisible upon start */
-webkit-animation:fadeIn ease-in 1; /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
-moz-animation:fadeIn ease-in 1;
animation:fadeIn ease-in 1;
-webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
-moz-animation-fill-mode:forwards;
animation-fill-mode:forwards;
-webkit-animation-duration:1s;
-moz-animation-duration:1s;
animation-duration:1s;
}
.fade-in.CHANGEmeHOWEVERlong {
-webkit-animation-delay: 4s;
-moz-animation-delay: 4s;
animation-delay: 4s;
}
.WithbackGroundImage {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/%C5%81u%C5%BCna_cemetery_-_Guardian_angel.jpg/90px-%C5%81u%C5%BCna_cemetery_-_Guardian_angel.jpg');
background-repeat: no-repeat;
background-size: 100% 100%;
border-style:none; <-- can be border-style:solid-->
}
/**********************************/
</style>
</head>
<body>
<div class="fade-in CHANGEmeHOWEVERlong ">
<div class="common FloatUP" id="four" style="
position:absolute;left:0px;top:0px;">
<div class="Angel03Pink" >
<img id="f1" src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Schutzengel_Dorigo.jpg/84px-Schutzengel_Dorigo.jpg">
<img id="f2" src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/%C5%81u%C5%BCna_cemetery_-_Guardian_angel.jpg/90px-%C5%81u%C5%BCna_cemetery_-_Guardian_angel.jpg">
<img id="f3" src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/%C5%81u%C5%BCna_cemetery_-_Guardian_angel.jpg/90px-%C5%81u%C5%BCna_cemetery_-_Guardian_angel.jpg">
</div>
four comes in after 4 seconds</div>
</div>
<div class="fade-in CHANGEmeHOWEVERlong">
<div class="common WithbackGroundImage FloatUP" id="four" style="
position:absolute;left:150px;top:0px;">four comes in after 4 seconds</div>
</div>
<div class="fade-in CHANGEmeHOWEVERlong">
<div class="common WithbackGroundImage" id="four" style="
position:absolute;left:300px;top:0px;">four comes in after 4 seconds</div></div>
<div class="common WithbackGroundImage" id="two" style="position:absolute;left:450px;top:0px;")>Div With backGroundImage</div><br>
</body>
</html>
Thanks
I I just had to swap the div around so that they read
{ I just had to swap the div around so that they read
I did a js fiddle on this at [1]http://jsfiddle.net/melvinT/81y3vy9m/
I have a question that might sound stupid, but here it goes anyways.
For starters, here is the website I'm creating.
www.redshedproductionsllc.com
I have an animation running on an h1 element on my website that fades in after a delay. The problem was is that the text showed before the animation started, so it kind of had a glitchy start. I found a workaround that works flawlessly on chrome, but not on any other browser. The element simply stays hidden. Here is my CSS.
#fading1 {
animation: fadein 4s;
-moz-animation: fadein 4s; /* Firefox */
-webkit-animation: fadein 4s; /* Safari and Chrome */
-o-animation: fadein 4s; /* Opera */
}
#fading2 {
visibility: hidden;
animation: fadein 4s;
-moz-animation: fadein 4s; /* Firefox */
-webkit-animation: fadein 4s; /* Safari and Chrome */
-o-animation: fadein -4s; /* Opera */
-moz-animation-delay: 2s;
-webkit-animation-delay: 2s;
-ms-animation-delay: 2s;
-o-animation-delay: 2s;
animation-delay: 2s;
-moz-animation-fill-mode: forwards; /*FF 5+*/
-webkit-animation-fill-mode: forwards; /*Chrome 16+, Safari 4+*/
-o-animation-fill-mode: forwards; /*Not implemented yet*/
-ms-animation-fill-mode: forwards; /*IE 10+*/
animation-fill-mode: forwards; /*when the spec is finished*/
}
Check it out on chrome, then check it out on firefox or safari. Chrome fades in flawlessly, while the other two stay hidden. Please help!!!
First of all, there is no such thing as moz-prefixed animation-delay. Having -moz-animation-delay: 2s is unneccessary. I'm not sure why it is working in chrome and not Firefox, but I have a feeling that the animation of visibility doesn't work well in all browsers.
It would make more sense to me to fade it in from opacity: 0 to opacity: 1 over three seconds, but make the first two seconds the delay, keeping the opacity at 0.
#keyframes fadein {
0% {opacity: 0;}
66% {opacity: 0;}
100% {opacity: 1;}
}
#-webkit-keyframes fadein {
0% {opacity: 0;}
66% {opacity: 0;}
100% {opacity: 1;}
}
.fade{
opacity: 1;
-moz-animation: fadein 3s;
animation: fadein 3s;
width: 100px;
height: 100px;
background: blue;
}
JSFiddle
I am not very sure but you have to use something like this:
So the thing is, you have to specify certain functions of CSS for each and every browser, so you should do like this:
#-webkit-keyframes fadein {
0% {opacity: 0;}
66% {opacity: 0;}
100% {opacity: 1;}
-moz-boxshadow
Read MDN guides for these prefixes.
Hope it helps! :)
I'm trying to create a beginner's CSS3 animation. It's working in Chrome, Opera and Safari but doesn't in Internet Explorer (11) and Firefox (34.0)
I'm using the -moz- prefix, but it isn't working… I don't know why.
body{
width:100%;
}
#center{
width:900px;
margin:0 auto;
height:800px;
display:block;
}
#center .box{
width:100px;
height:100px;
background-color:black;
margin:0 auto;
-webkit-animation: myfirst 5s; /* Chrome, Safari, Opera */
animation: myfirst 5s; /*Explorer*/
-moz-animation: myfirst 5s; /*Mozilla*/
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
#-webkit-keyframes myfirst{
from{backgrond:black;}
to{background:yellow;}
}
#-moz-keyframes myfirst{
from{background:black;}
to{background: :yellow;}
}
#keyframes myfirst {
from{background:black;}
to{background: :yellow;}
}
JSFiddle
There are a few small tweaks required for your animation to work:
remove the double ::, as this isn't correct syntax
your non-prefixed animation should be placed below any prefixed animations.
LIVE DEMO
tested in Chrome 39, IE 11 and Firefox 33
You need to correct the typo : inside the keyframes
Check fiddle here
#center .box{
width:100px;
height:100px;
margin:0 auto;
background-color:black;
-webkit-animation: myfirst 5s; /* Chrome, Safari, Opera */
-webkit-animation-iteration-count: infinite; /*Végtelen újrajátszás */
-moz-animation: myfirst 5s; /*Mozilla*/
-moz-animation-iteration-count: infinite;
animation: myfirst 5s; /*Explorer*/
animation-iteration-count: infinite;
}
#-webkit-keyframes myfirst{
from{background:black;}
to{background:yellow;}
}
#-moz-keyframes myfirst{
from{background:black;}
to{background:yellow;}
}
#keyframes myfirst {
from{background:black;}
to{background:yellow;}
}
Below i have corrected the keyframes don't use unwanted semi-colon
#-moz-keyframes myfirst{ /* firefox */
from{background:black;}
to{background: :yellow;}
}
#-ms-keyframes myfirst{ /* explorer */
from{background:black;}
to{background: yellow;}
}
and also and the box class
-ms-animation: myfirst 5s; /*Explorer*/
I added all the prefixes and still not working ?
It is like a slideshow that uses css to change the background to different images.
I don't understand what the problem is I looked everything over like 100 times.
You can see it on http://steveedwin.com/
html{
max-width:1000px;
}
#slideshow{
background-image: url('1.jpg') ;
background-repeat:no-repeat;
background-size: 70% 350px;
width:100%;
height: 300px;
animation:myfirst 30s linear 1s infinite alternate;
/* Firefox: */
-moz-animation:myfirst 30s linear 1s infinite alternate;
/* Safari and Chrome: */
-webkit-animation:myfirst 30s linear 1s infinite alternate;
/* Opera: */
-o-animation:myfirst 30s linear 1s infinite alternate;
}
#keyframes myfirst
{
0% {background-image:url('1.jpg');}
5%{background-image:url('1.jpg');}
10%{background-image:url('1.jpg');}
15%{background-image:url('1.jpg');}
20%{background-image:url('5.jpg');}
25%{background-image:url('5.jpg');}
30%{background-image:url('5.jpg');}
40%{background-image:url('5.jpg');}
45%{background-image:url('2.jpg'); }
50%{background-image:url('2.jpg'); }
55%{background-image:url('2.jpg'); }
60%{background-image:url('2.jpg'); }
70%{background-image:url('3.jpg');}
75%{background-image:url('3.jpg');}
80%{background-image:url('3.jpg');}
85%{background-image:url('4.jpg');}
90%{background-image:url('4.jpg');}
95%{background-image:url('4.jpg');}
100%{background-image:url('4.jpg');}
}
#-moz-keyframes myfirst /* Firefox */
{
0% {background-image:url('1.jpg');}
5%{background-image:url('1.jpg');}
10%{background-image:url('1.jpg');}
15%{background-image:url('1.jpg');}
20%{background-image:url('5.jpg');}
25%{background-image:url('5.jpg');}
30%{background-image:url('5.jpg');}
40%{background-image:url('5.jpg');}
45%{background-image:url('2.jpg'); }
50%{background-image:url('2.jpg'); }
55%{background-image:url('2.jpg'); }
60%{background-image:url('2.jpg'); }
70%{background-image:url('3.jpg');}
75%{background-image:url('3.jpg');}
80%{background-image:url('3.jpg');}
85%{background-image:url('4.jpg');}
90%{background-image:url('4.jpg');}
95%{background-image:url('4.jpg');}
100%{background-image:url('4.jpg');}
}
#-webkit-keyframes myfirst /* Safari and Chrome */
{
0% {background-image:url('1.jpg');}
5%{background-image:url('1.jpg');}
10%{background-image:url('1.jpg');}
15%{background-image:url('1.jpg');}
20%{background-image:url('5.jpg');}
25%{background-image:url('5.jpg');}
30%{background-image:url('5.jpg');}
40%{background-image:url('5.jpg');}
45%{background-image:url('2.jpg'); }
50%{background-image:url('2.jpg'); }
55%{background-image:url('2.jpg'); }
60%{background-image:url('2.jpg'); }
70%{background-image:url('3.jpg');}
75%{background-image:url('3.jpg');}
80%{background-image:url('3.jpg');}
85%{background-image:url('4.jpg');}
90%{background-image:url('4.jpg');}
95%{background-image:url('4.jpg');}
100%{background-image:url('4.jpg');}
}
#-o-keyframes myfirst /* Opera */
{
0% {background-image:url('1.jpg');}
5%{background-image:url('1.jpg');}
10%{background-image:url('1.jpg');}
15%{background-image:url('1.jpg');}
20%{background-image:url('5.jpg');}
25%{background-image:url('5.jpg');}
30%{background-image:url('5.jpg');}
40%{background-image:url('5.jpg');}
45%{background-image:url('2.jpg'); }
50%{background-image:url('2.jpg'); }
55%{background-image:url('2.jpg'); }
60%{background-image:url('2.jpg'); }
70%{background-image:url('3.jpg');}
75%{background-image:url('3.jpg');}
80%{background-image:url('3.jpg');}
85%{background-image:url('4.jpg');}
90%{background-image:url('4.jpg');}
95%{background-image:url('4.jpg');}
100%{background-image:url('4.jpg');}
}