CSS Animation problems on Chrome - css

I am trying to make a part of my webpage animate once the page is fully loaded. The animation works perfectly on Internet Explorer 11 however it doesn't run on Chrome (version 31.0.1650.63 m) up to date version. The only time the animation actually runs properly on Chrome is if I reload the page, navigate away from the tab (So basically click on another tab that is open), wait for the page to load, then once I click back on the tab with the animation, the page then refreshes itself and loads the animation properly but if I reload the page and do not navigate away from the tab and simply wait for the page to load, the animation doesn't run. This seems really odd I and have no clue what to look for in the code because I assume it should work properly. Any clues??
Here's the css.
.mainpart
{
height:80%;
width:100%;
background-color:#eee;
white-space:nowrap;
z-index:10;
max-height:520px;
-webkit-animation: rotateInRight 4s; /* Safari 4+ */
-moz-animation: rotateInRight 4s; /* Fx 5+ */
-o-animation: rotateInRight 4s; /* Opera 12+ */
animation: rotateInRight 4s; /* IE 10+ */
}
#keyframes rotateInRight {
from {
transform-origin: 100% 0%;
transform: rotateY(-180deg);
}
to {
transform-origin: 100% 0%;
}
}
#-webkit-keyframes rotateInRight {
from {
-webkit-transform-origin: 100% 0%;
-webkit-transform: rotateY(-180deg);
}
to {
-webkit-transform-origin: 100% 0%;
}
}
#-moz-keyframes rotateInUpLeft {
from {
-moz-transform-origin: 100% 0%;
-moz-transform: rotateY(-180deg);
}
to {
-moz-transform-origin: 100% 0%;
}
}
#-o-keyframes rotateInUpLeft {
from {
-o-transform-origin: 100% 0%;
-o-transform: rotateY(-180deg);
}
to {
-o-transform-origin: 100% 0%;
}
}
And here is the html with the mainpart class:
div class="mainpart" style="overflow: hidden; outline: none; background-color: transparent;" tabindex="5000" >
...........
</div>

This is working for me in Firefox, Chrome, and IE 10.
I cleaned up the CSS and removed the inline styles. Also, you were missing a < in the HTML.
http://jsfiddle.net/R4THN/
HTML:
<div class="mainpart" tabindex="5000">
...........
</div>
CSS:
.mainpart {
height: 80%;
width: 100%;
background-color: #eee;
white-space: nowrap;
z-index: 10;
max-height: 520px;
overflow: hidden;
outline: none;
background-color: transparent;
-webkit-animation: rotateInRight 4s; /* Safari 4+ */
-moz-animation: rotateInRight 4s; /* Fx 5+ */
-o-animation: rotateInRight 4s; /* Opera 12+ */
animation: rotateInRight 4s; /* IE 10+ */
}
#keyframes rotateInRight {
from {
transform-origin: 100% 0%;
transform: rotateY(-180deg);
}
to {
transform-origin: 100% 0%;
}
}
#-webkit-keyframes rotateInRight {
from {
-webkit-transform-origin: 100% 0%;
-webkit-transform: rotateY(-180deg);
}
to {
-webkit-transform-origin: 100% 0%;
}
}
#-moz-keyframes rotateInUpLeft {
from {
-moz-transform-origin: 100% 0%;
-moz-transform: rotateY(-180deg);
}
to {
-moz-transform-origin: 100% 0%;
}
}
#-o-keyframes rotateInUpLeft {
from {
-o-transform-origin: 100% 0%;
-o-transform: rotateY(-180deg);
}
to {
-o-transform-origin: 100% 0%;
}
}
So, if you still having issues, it must be with something else on your page, not this code specifically.

Related

Auto scrolling (snapping) text with CSS only?

At the moment I have a CSS autoscrolling text that looks like this:
.vscroll {
position: absolute;
height: auto;
/* Starting position */
-moz-transform:translateY(100%);
-webkit-transform:translateY(100%);
transform:translateY(100%);
/* Apply animation to this element */
-moz-animation: scroll-up 25s linear infinite;
-webkit-animation: scroll-up 25s linear infinite;
animation: scroll-up 25s linear infinite;
}
/* Move it (define the animation) */
#-moz-keyframes scroll-up {
0% { -moz-transform: translateY(100%); }
100% { -moz-transform: translateY(-100%); }
}
#-webkit-keyframes scroll-up {
0% { -webkit-transform: translateY(100%); }
100% { -webkit-transform: translateY(-100%); }
}
#keyframes scroll-up {
0% {
-moz-transform: translateY(100%); /* Browser bug fix */
-webkit-transform: translateY(100%); /* Browser bug fix */
transform: translateY(100%);
}
100% {
-moz-transform: translateY(-100%); /* Browser bug fix */
-webkit-transform: translateY(-100%); /* Browser bug fix */
transform: translateY(-100%);
}
}
This works, but it does look a bit choppy on some devices. So I am hoping it is possible to do something like this but with only CSS instead of jQuery: https://www.jqueryscript.net/demo/Vertical-Text-Scrolling-Plugin-With-jQuery-scrollText-js/
Is it possible?
Hope this will help (Sample).
<!DOCTYPE html>
<title>Example</title>
<!-- Styles -->
<style>
.example1 {
height: 50px;
overflow: hidden;
position: relative;
}
.example1 h3 {
font-size: 3em;
color: limegreen;
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%);
}
}
</style>
<!-- HTML -->
<div class="example1">
<h3>Scrolling text... </h3>
</div>

How to keep image with Ken Burns effect in bigger size?

I am using Ken Burns effect on image. It runs very well, the image is going bigger to 1.2 scale. But after animation the image will return to 1.0 scale. How to make it to stay in 1.2 scale?
I am sending a code below how my Ken Burns works.
Thank you.
.logopartner {
position: absolute;
top: 25%;
left: 25%;
  animation: move 80s ease;
/* Add infinite to loop. */
-ms-animation: move 20s ease;
-webkit-animation: move 20s ease;
-0-animation: move 20s ease;
-moz-animation: move 20s ease;
position: absolute;
}
#-webkit-keyframes move {
0% {
-webkit-transform-origin: bottom left;
-moz-transform-origin: bottom left;
-ms-transform-origin: bottom left;
-o-transform-origin: bottom left;
transform-origin: bottom left;
transform: scale(1.0);
-ms-transform: scale(1.0);
/* IE 9 */
-webkit-transform: scale(1.0);
/* Safari and Chrome */
-o-transform: scale(1.0);
/* Opera */
-moz-transform: scale(1.0);
/* Firefox */
}
100% {
transform: scale(1.2);
-ms-transform: scale(1.2);
/* IE 9 */
-webkit-transform: scale(1.2);
/* Safari and Chrome */
-o-transform: scale(1.2);
/* Opera */
-moz-transform: scale(1.2);
/* Firefox */
}
}
<img class="logopartner" src="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon#2.png?v=73d79a89bded">
You can set the scale to 1.2 by default so its final destination is its default scale.
.logopartner {
position: absolute;
top: 25%;
left: 25%;
  animation: move 80s ease;
transform: scale(1.2);
/* Add infinite to loop. */
-ms-animation: move 20s ease;
-webkit-animation: move 20s ease;
-0-animation: move 20s ease;
-moz-animation: move 20s ease;
position: absolute;
}
#-webkit-keyframes move {
0% {
-webkit-transform-origin: bottom left;
-moz-transform-origin: bottom left;
-ms-transform-origin: bottom left;
-o-transform-origin: bottom left;
transform-origin: bottom left;
transform: scale(1.0);
-ms-transform: scale(1.0);
/* IE 9 */
-webkit-transform: scale(1.0);
/* Safari and Chrome */
-o-transform: scale(1.0);
/* Opera */
-moz-transform: scale(1.0);
/* Firefox */
}
100% {
transform: scale(1.2);
-ms-transform: scale(1.2);
/* IE 9 */
-webkit-transform: scale(1.2);
/* Safari and Chrome */
-o-transform: scale(1.2);
/* Opera */
-moz-transform: scale(1.2);
/* Firefox */
}
}
<img class="logopartner" src="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon#2.png?v=73d79a89bded">

webkit animation works in chrome but not firefox

I have this fiddle http://jsfiddle.net/Dgy2Q/3/
#LeftDoor{
position: absolute;
height: 100%;
width:50%;
z-index: 30;
background-color: blue;
left:0px;
-webkit-animation: leftDoorOpen 1s ease 1s;
-webkit-animation-fill-mode: forwards;
-moz-animation: leftDoorOpen 4s ease 4s;
-moz-animation-fill-mode: forwards;
}
#-webkit-keyframes leftDoorOpen {
from {
-webkit-transform: perspective(300) rotateY(0deg);
-webkit-transform-origin: 0% 0%;
}
to {
-webkit-transform: perspective(300) rotateY(90deg);
-webkit-transform-origin: 0% 0%;
}
}
#-moz-keyframes leftDoorOpen {
from {
-moz-transform: perspective(300) rotateY(0deg);
-moz-transform-origin: 0% 0%;
}
to {
-moz-transform: perspective(300) rotateY(90deg);
-moz-transform-origin: 0% 0%;
}
}
that works great in chrome. It doesn't work in firefox, I can't see what I am doing wrong??? Can anyone see what I have done wrong?
thanks
have amended the fiddle but still no joy? anything else?
http://jsfiddle.net/Dgy2Q/10/
You have errors in the perspective function. Its parameter should be a length, with a unit. Change the 300 to 300px and it will work in Firefox.
http://jsfiddle.net/MrLister/Dgy2Q/6/
The result is not identical though. Not sure what causes that, if it can be corrected with CSS or if it's simply different implementations in the browsers.

CSS3 Transform Perspective Not Working in FF or IE - Swing Effect

I'm relatively new to CSS3 transform and keyframe animations so tend to stick to CSS generators or ripping other examples. I have modified the example shown here for my own purposes which works great in Chrome but not in FF or IE - http://webbb.be/blog/making-a-swinging-effect-with-css3-animations/.
See my example below (js fiddle included), in essence this is a swing effect on hover using perspective but the perspective doesn't seem to work in FF and IE.. I have only added the -moz- pre fix to the example below... any ideas?
a { display: block;
float:left;
text-indent: -999px;
overflow: hidden;
height: 100px;
width: 100px;
background: red;
cursor: pointer;
}
.perspective {
position: relative;
-webkit-perspective: 350;
-moz-perspective: 350;
width: 100px;
height: 100px;
}
.perspective .swing {
position: relative;
z-index:1;
-webkit-transition: all 250ms ease;
-moz-transition: all 250ms ease;
}
a.swing:hover {
-webkit-transform-origin: top;
-moz-transform-origin: top;
-webkit-animation: balance 1.5s ease-in-out 110ms 1 alternate;
-moz-animation: balance 1.5s ease-in-out 110ms 1 alternate;
}
#-webkit-keyframes balance {
25% { -webkit-transform: rotateX(-60deg); }
45% { -webkit-transform: rotateX(50deg); }
69% { -webkit-transform: rotateX(-30deg); }
90% { -webkit-transform: rotateX(30deg); }
100% { -webkit-transform: rotateX(0deg);}
}
#-moz-keyframes balance {
25% { -moz-transform: rotateX(-60deg); }
45% { -moz-transform: rotateX(50deg); }
69% { -moz-transform: rotateX(-30deg); }
90% { -moz-transform: rotateX(30deg); }
100% { -moz-transform: rotateX(0deg);}
}
http://jsfiddle.net/7ejF7/1/
You need to add px values for perspective to work on non-webkit browsers.
-moz-perspective: 350px;
http://jsfiddle.net/mZMGd/
Try to add the statement for none -webkit- or -moz- browsers.
i haven't tried it but it could be the solution.
transform-origin: top;
animation: balance 1.5s ease-in-out 110ms 1 alternate;
#keyframes balance {
25% { transform: rotateX(-60deg);}
45% { transform: rotateX(50deg); }
69% { transform: rotateX(-30deg); }
90% { transform: rotateX(30deg); }
100% { transform: rotateX(0deg);}
}
TJL

Why is my CSS3 animation not working in Chrome or Safari?

I'm using a translate animation, but it doesn't work in Safari or Chrome. What am I doing wrong?
Here's my code, and a JSFiddle of it in action:
HTML
<div id="animate"></div>
CSS
#animate {
position: absolute;
top: 100px;
left: 30px;
width: 100px;
height: 100px;
border-radius: 10%;
background: gray;
-webkit-animation:move 6s ease infinite;
-moz-animation:move 6s ease infinite;
animation: move 6s ease infinite;
}
#keyframes move {
50% {
transform: translate(800px, 0px);
}
}
#-webkit-keyframes move {
50% {
transform: translate(800px, 0px);
}
}
#-moz-keyframes move {
50% {
transform: translate(800px, 0px);
}
}
Webkit still needs the -webkit prefix for transform:
#-webkit-keyframes move {
50% {
-webkit-transform: translate(800px, 0px);
}
}
Demo: http://jsfiddle.net/MLhYS/3/

Resources