I have looked at different answers posted on here but nothing has worked for me...
What: I have a div that is scaled down to 0.6 and when called should scale up to 1 (100%).
Problem: In Firefox #myDiv is scaling up as intended, but nothing happens in Chrome or Safari (on mac).
I have this DIV code:
#myDiv {
-moz-animation: changeSize 1s ease-out .5s forwards; /* Fx 5+ */
-webkit-animation: changeSize 1s ease-out .5s 0 forwards; /* Safari 4+ */
-o-animation: changeSize 1s ease-out .5s forwards; /* Opera */
-webkit-transform: scale(0.6);/* Saf3.1+, Chrome */
-moz-transform: scale(0.6); /* FF3.5+ */
-ms-transform: scale(0.6); /* IE9 */
-o-transform: scale(0.6); /* Opera 10.5+ */
transform: scale(0.6);
display: inline-block;
opacity:100;
background-image: url(img.png);
width: 154px;
height: 28px;
position: absolute;
left: 145px;
top: 5px;
}
And the keyframe animation for the scale up transition:
#keyframes changeSize {
0% {transform:scale(0.6)}
100% {transform: scale(1)}
}
#-moz-keyframes changeSize /* Firefox */ {
0% {transform:scale(0.6)}
100% {transform:scale(1)}
}
#-webkit-keyframes changeSize /* Safari and Chrome */{
0% {transform:scale(0.6)}
100% {transform:scale(1)}
}
#-o-keyframes changeSize /* Opera */ {
0% {transform:scale(0.6)}
100% {transform:scale(1)}
}
The HTML:
Please advise what I am missing here!
Thanks!
Your error is in this line :
-webkit-animation: changeSize 1s ease-out .5s 0 forwards;
There is an unnecessary 0!
Lastly,
#-moz-keyframes changeSize /* Firefox */ {
0% {transform:scale(0.6)}
100% {transform:scale(1)}
}
#-webkit-keyframes changeSize /* Safari and Chrome */{
0% {transform:scale(0.6)}
100% {transform:scale(1)}
}
#-o-keyframes changeSize /* Opera */ {
0% {transform:scale(0.6)}
100% {transform:scale(1)}
}
Within these keyframes, you're missing something. None of the transform property have browser support prefixes. For example:
#-webkit-keyframes changeSize /* Safari and Chrome */{
0% {-webkit-transform:scale(0.6)}
100% {**-webkit-**transform:scale(1)}
}
I added -webkit- prefix to the transform property now it will display in Google Chrome and Safari.
Side note: you might have some unnecessary code blocks. -moz-,-ms-, and -o-.
Related
I'm trying to have a scrolling marquee of sorts across the top of my webpage. I'm not using the tag as it is not supported by Safari. However, even with using CSS Animation, it doesn't seem to work for Safari either. Here's my code:
<h3>Upcoming Shows:...</h3>
This is what I have in my style sheet:
h3 {
position: absolute;
width: 100%;
height: 100%;
margin: 0;
line-height: 50px;
text-align: center;
/* Starting position */
-moz-transform:translateX(100%);
-webkit-transform:translateX(100%);
transform:translateX(100%);
/* Apply animation to this element */
-moz-animation: example1 15s linear infinite;
-webkit-animation: example1 15s linear infinite;
animation: example1 15s linear infinite;
}
/* Move it (define the animation) */
#-moz-keyframes example1 {
0% { -moz-transform: translateX(100%); }
100% { -moz-transform: translateX(-100%); }
}
#-webkit-keyframes example1 {
0% { -webkit-transform: translateX(100%); }
100% { -webkit-transform: translateX(-100%); }
}
#keyframes example1 {
0% {
-moz-transform: translateX(100%); /* Firefox bug fix */
-webkit-transform: translateX(100%); /* Firefox bug fix */
transform: translateX(100%);
}
100% {
-moz-transform: translateX(-100%); /* Firefox bug fix */
-webkit-transform: translateX(-100%); /* Firefox bug fix */
transform: translateX(-100%);
}
}
I found one example from this. It worked fine, but anybody knows how to make scrolling start immediately and after it finish scroll from right to left, immediately it start again. Because right now it wait about 3 second to start scrolling. Thanks.
Below is the CSS:
.example1 {
height: 50px;
overflow: hidden;
position: relative;
}
.example1 h3 {
position: absolute;
width: 100%;
height: 100%;
margin: 0;
line-height: 50px;
text-align: center;
/* Starting position */
-moz-transform:translateX(100%);
-webkit-transform:translateX(100%);
transform:translateX(100%);
/* Apply animation to this element */
-moz-animation: example1 10s linear infinite;
-webkit-animation: example1 10s linear infinite;
animation: example1 10s linear infinite;
}
/* Move it (define the animation) */
#-moz-keyframes example1 {
0% { -moz-transform: translateX(100%); }
100% { -moz-transform: translateX(-100%); }
}
#-webkit-keyframes example1 {
0% { -webkit-transform: translateX(100%); }
100% { -webkit-transform: translateX(-100%); }
}
#keyframes example1 {
0% {
-moz-transform: translateX(100%); /* Firefox bug fix */
-webkit-transform: translateX(100%); /* Firefox bug fix */
transform: translateX(100%);
}
100% {
-moz-transform: translateX(-100%); /* Firefox bug fix */
-webkit-transform: translateX(-100%); /* Firefox bug fix */
transform: translateX(-100%);
}
}
From the example you have shown, all you need to do is add the following styles. .example1 h3 {display: inline-block; width: auto;} and change the animation to about 5s intervals.
The reason it scrolls late is because the width of the h3 is the full width of the screen/div with a centered text so it will be delayed by default.
my code as follows
#-webkit-keyframes arrow-jump2 {
0% { opacity: 1;}
100% { opacity: 1;
-webkit-transform: translateX(258px);
-moz-transform: translateX(258px);
-0-transform: translateX(258px);
transform: translateX(258px);
}
}
.arrow3 {
-webkit-animation: arrow-jump2 3s forwards; /* Safari 4+ */
-moz-animation: arrow-jump2 2s forwards; /* Fx 5+ */
-o-animation: arrow-jump2 2s forwards; /* Opera 12+ */
animation: arrow-jump2 2s forwards; /* IE 10+, Fx 29+ */
}
the above code works fine with chrome but not with firefox
#-webkit-keyframes arrow-jump2 {
0% { opacity: 1;}
100% { opacity: 1;
-webkit-transform: translateX(258px);
-moz-transform: translateX(258px);
-0-transform: translateX(258px);
transform: translateX(258px);
}
}
#keyframes arrow-jump2 {
0% { opacity: 1;}
100% { opacity: 1;
-webkit-transform: translateX(258px);
-moz-transform: translateX(258px);
-0-transform: translateX(258px);
transform: translateX(258px);
}
}
.arrow3 {
-webkit-animation: arrow-jump2 3s forwards; /* Safari 4+ */
-moz-animation: arrow-jump2 2s forwards; /* Fx 5+ */
-o-animation: arrow-jump2 2s forwards; /* Opera 12+ */
animation: arrow-jump2 2s forwards; /* IE 10+, Fx 29+ */
}
firefox dont need -webkit-
I'm trying to get several animations running at the time in a small banner. A change of position with an opacity change in the first line of text, a simple opacity change in another one and so on. The problem is that the first animation works perfectly and the second one (and everything after that) never runs. I used exactly the same code as in the first one and just changed the name of the animation as well as the class but it's still not working.
This is the code I used for the first ones, (H1 works just fine but h2, h3 and the rest of the animation don't)
My HTML
<h1> Smart travel,
<br> at your fingertips. </h1>
<h2> Our app for Iphone and Ipad is here </h2>
<h3><strong>Download </strong> it today. </h3>
My CSS (By the way, some lines above all of this is set up as position: absolute)
h1 {
position: relative;
right: 0px;
-webkit-animation: mymove 1s ; /* Chrome, Safari, Opera */
animation: mymove 1s ;
animation-timing-function: linear;
-webkit-animation-timing-function: linear;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes mymove {
0% {
transform: opacity: 0;
}
25% {transform: translate3d(90px, 0px, 0px);
opacity:0;
}
100% {
transform: translate3d(0px, 0px, 0px);
opacity: 100;
}
h2 {
position: relative;
-webkit-animation: mymove2 3s ; /* Chrome, Safari, Opera */
animation: mymove2 3s ;
animation-timing-function: linear;
-webkit-animation-timing-function: linear;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes mymove2 {
0% {
opacity: 0;
}
50% {
opacity:0;
}
100% {
opacity: 100;
}
You didn't close this #-webkit-keyframes mymove { Check this fiddle
h1 {
position: relative;
right: 0px;
-webkit-animation: mymove 1s;
/* Chrome, Safari, Opera */
animation: mymove 1s;
animation-timing-function: linear;
-webkit-animation-timing-function: linear;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes mymove {
0% {
transform: opacity: 0;
}
25% {
transform: translate3d(90px, 0px, 0px);
opacity:0;
}
100% {
transform: translate3d(0px, 0px, 0px);
opacity: 100;
}
}
h2 {
position: relative;
-webkit-animation: mymove2 3s;
/* Chrome, Safari, Opera */
animation: mymove2 3s;
animation-timing-function: linear;
-webkit-animation-timing-function: linear;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes mymove2 {
0% {
opacity: 0;
}
50% {
opacity:0;
}
100% {
opacity: 100;
}
<h1> Smart travel,
<br> at your fingertips. </h1>
<h2> Our app for Iphone and Ipad is here </h2>
<h3><strong>Download </strong> it today. </h3>
I guess this comes from an error in your CSS code :
transform: opacity: 0; /* Syntax error there */
/* should be */
opacity: 0;
transform: translate3d(0px, 0px, 0px); /* or whatever starting value you want */
You should also note that you have prefixed the keyframes of your animation (#-webkit-keyframes mymove), this can only work on wekbit based browsers.
The last brace is missing, but it's not considered as an error (the last brace / semicolon are optional).
This is code that I am using to rotate a image:
<style>
#logo1{ position: absolute;
-moz-animation: 3s rotate infinite linear ;
-moz-transform-origin: 50% 50%;
-webkit-animation: 3s rotate infinite linear ;
-webkit-transform-origin:50% 50%;
}
#-moz-keyframes rotate {
0 { -moz-transform: rotate(0); }
100% { -moz-transform: rotate(360deg); }
}
#-webkit-keyframes rotate {
0% { -webkit-transform: rotate(0); }
100% { -webkit-transform: rotate(360deg); }
}
</style>
This code is working fine for firefox, safari and chrome. But its not working for Internet Explorer. What changes I need to do please help....
<style>
#logo1{ position: absolute;
animation:3s rotate infinite linear ;/* IE 10 */
transform-origin:50% 50%;/* IE 10 */
-moz-animation: 3s rotate infinite linear ;
-moz-transform-origin: 50% 50%;
-webkit-animation: 3s rotate infinite linear ;
-webkit-transform-origin:50% 50%;
}
#-moz-keyframes rotate {
0 { -moz-transform: rotate(0); }
100% { -moz-transform: rotate(360deg); }
}
#-webkit-keyframes rotate {
0% { -webkit-transform: rotate(0); }
100% { -webkit-transform: rotate(360deg); }
}
#keyframes rotate{
0 { transform: rotate(0);} /* IE 10 */
100% { transform: rotate(360deg);} /* IE 10 */
}
</style>
jsfiddle demo
You can use transform for IE 10/11, and -ms-transform for IE 9.
More compatibility info: http://caniuse.com/#search=transform
If you need support for older IE add this too:
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
The rotation property of Internet Explorer’s BasicImage filter can accept one of four values: 0, 1, 2, or 3 which will rotate the element 0, 90, 180 or 270 degrees respectively.