I'm not even sure what else to try. I've even put it through a CSS validator and it passes. Works in Chrome and Firefox. Safari shows no warnings or errors that I can tell.
Relevant CSS:
.lines {
width: 32px;
margin: 20px auto;
}
.line-bar {
display: inline-block;
background-color: #f7f7f7;
width: 4px;
height: 18px;
border-radius: 4px;
-webkit-animation: loading 1s ease-in-out infinite;
animation: loading 1s ease-in-out infinite;
}
.line-bar:nth-child(1) {
}
.line-bar:nth-child(2) {
-webkit-animation-delay: 0.09s;
animation-delay: 0.09s;
}
.line-bar:nth-child(3) {
-webkit-animation-delay: 0.18s;
animation-delay: 0.18s;
}
.line-bar:nth-child(4) {
-webkit-animation-delay: 0.27s;
animation-delay: 0.27s;
}
#-webkit-keyframes loading {
0% {
transform: scale(1);
}
20% {
transform: scale(1, 2.2);
}
40% {
transform: scale(1);
}
}
#keyframes loading {
0% {
transform: scale(1);
}
20% {
transform: scale(1, 2.2);
}
40% {
transform: scale(1);
}
}
http://jsbin.com/yobatuveji/1
You need to use webkit- vendor prefix also on the transform property
#-webkit-keyframes loading {
0% {
-webkit-transform: scale(1);
}
20% {
-webkit-transform: scale(1, 2.2);
}
40% {
-webkit-transform: scale(1);
}
}
Since these keyframes are introduced by the -webkit- prefix.
With this change the animation runs as expected also on Safari (just checked on v.7.1.2/MacOs).
Related
Below css animation works perfect on the old iOS versions.
However, it does not work proper on newest version, iOS12.2.
The animation starts and works when first visiting website. But after reloading browser, it does not start animation.
Any solutions?
.button {
display: block;
width: 400px;
height: 50px;
background-color: gray;
position: relative;
}
.button:before {
position: absolute;
left: -75%;
width: 25px;
height: 50px;
content: '';
display:block;
background-color: white;
-webkit-animation: shine 1.5s ease 0.5s infinite normal;
animation: shine 1.5s ease 0.5s infinite normal;
}
#-webkit-keyframes shine {
0% { left: -75%;}
50%, 100% { left: 125%; }
}
#keyframes shine {
0% { left: -75%; }
50%, 100% { left: 125%; }
}
<a class="button">Hello
</a>
Try the following example - before make sure that you clear browser cache:
.button {
display: block;
width: 400px;
height: 50px;
background-color: gray;
position: relative;
}
.button::before {
position: absolute;
left: 100px;
width: 25px;
height: 50px;
content: '';
display:block;
background-color: white;
-webkit-animation: shine 1.5s ease 0.5s infinite normal;
animation: shine 1.5s ease 0.5s infinite normal;
}
#-webkit-keyframes shine {
0% { left: -100px;}
50%, 100% { left: calc(100% + 80px); }
}
#keyframes shine {
0% { left: -100px; }
50%, 100% { left: calc(100% + 80px); }
}
<a class="button">Hello
</a>
This code works well on Mozilla Firefox, Google Chrome, and MS explorer. However, it doesn't work at all on mobile devices, particularly iOS. Please let me know what needs to be added or removed to make it function properly.
HTML
<div class="bg-grad">
<div class="clouds">
<div class="cloud x1"></div>
</div>
</div>
CSS
/* BG Gradients
~-----------------------------------------*/
.bg-grad {
background: #000;
background: transparent url("http://www.freelargeimages.com/wp-content/uploads/2014/12/Landscape_01.jpg") center bottom no-repeat;
-moz-background-size: cover;
-o-background-size: cover;
-webkit-background-size: cover;
background-size: cover;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.bg-grad .bg-layer {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0;
z-index: 6;
-moz-transition: opacity 0.5s ease;
-o-transition: opacity 0.5s ease;
-webkit-transition: opacity 0.5s ease;
transition: opacity 0.5s ease;
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.bg-grad .bg-layer.on {
opacity: 1;
}
/* Clouds
~-----------------------------------------*/
.cloud {
width: 100%;
height: 900px;
position: relative;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 5;
background: transparent url('http://freepngimages.com/wp-content/uploads/2014/11/ten-party-balloons.png') left bottom no-repeat;
-moz-background-size: cover;
-o-background-size: cover;
-webkit-background-size: cover;
background-size: cover;
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
#media (max-width: 550px) {
.cloud {
display: none;
}
}
.x1 {
-moz-animation: moveclouds 40s linear infinite;
-webkit-animation: moveclouds 40s linear infinite;
animation: moveclouds 40s linear infinite;
width: 2036px;
height: 1608px;
}
#-webkit-keyframes moveclouds {
0% {
margin-left: 100%;
}
100% {
margin-left: -1400px;
}
}
#-moz-keyframes moveclouds {
0% {
margin-left: 100%;
}
100% {
margin-left: -1400px;
}
}
#-o-keyframes moveclouds {
0% {
margin-left: 100%;
}
100% {
margin-left: -1400px;
}
}
https://jsfiddle.net/r2uuvubg/2/
I've made a simple animation I want to use as a pre-loader for my website using CSS animations.
It seems to work beautifully on everything except iOS devices, where the separate elements seem to fire out of sync and end up just doing their own thing.
You can see the fiddle and try it own on your phone here
UPDATE:
Weird – so the JSfiddle seems to work fine on iOS but when the same code comes into practice live on my site it seems to mess things up? you can see it here
Makes me think its actually something to do with my pre-loading script?
$(window).load(function() { // makes sure the whole site is loaded
$('#status').fadeOut(); // will first fade out the loading animation
$('#preloader').delay(350).fadeOut(300); // will fade out the white DIV that covers the website.
$('body').delay(350).css({'overflow':'visible'});
})
CSS
.square {
background: #61CAFF;
width: 150px;
height: 150px;
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-animation: shrinkgrow 3s ease-in-out infinite;
animation: shrinkgrow 3s ease-in-out infinite;
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.circle {
background: #9DFDC3;
width: 150px;
height: 150px;
border-radius: 50%;
-webkit-animation: shrinkgrow 3s ease-in-out infinite;
animation: shrinkgrow 3s ease-in-out infinite;
-webkit-animation-delay: 0s;
animation-delay: 0s;
}
.triangle {
width: 0;
height: 0;
border-style: solid;
border-width: 0 80px 140px 80px;
border-color: transparent transparent #F896D5 transparent;
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-animation: shrinkgrow 3s ease-in-out infinite;
animation: shrinkgrow 3s ease-in-out infinite;
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
#-webkit-keyframes shrinkgrow {
0% {
-webkit-transform: scale(0);
transform: scale(0);
}
12.5% {
-webkit-transform: scale(1);
transform: scale(1);
}
25% {
-webkit-transform: scale(1);
transform: scale(1);
}
33% {
-webkit-transform: scale(0);
transform: scale(0);
}
100% {
-webkit-transform: scale(0);
transform: scale(0);
}
}
#keyframes shrinkgrow {
0% {
-webkit-transform: scale(0);
transform: scale(0);
}
12.5% {
-webkit-transform: scale(1);
transform: scale(1);
}
25% {
-webkit-transform: scale(1);
transform: scale(1);
}
33% {
-webkit-transform: scale(0);
transform: scale(0);
}
100% {
-webkit-transform: scale(0);
transform: scale(0);
}
}
Can anybody tell why this CSS3 Animation refuses to work when I test it on my Iphone? It works fine on Chrome.
.heartbeat:after {
content: "\f118";
font-family: fontAwesome;
font-size: 50px;
color: rgb(0, 156, 255);
-webkit-animation: spin 1000ms ease 0s infinite normal;
-moz-animation: spin 1000ms ease 0s infinite normal;
-ms-animation: spin 1000ms ease 0s infinite normal;
-o-animation: spin 1000ms ease 0s infinite normal;
animation: spin 1000ms ease 0s infinite normal;
}
#-ms-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
#-moz-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
#-webkit-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
#keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
I checked similar questions and tried to replace from and to with 0% and 100%, and rotate 180 degrees at a time, use rotate3d instead; didnt work.
There is a reason behind this. You have an error here:
#-ms-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
#-moz-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
#-webkit-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
#keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
Notice anything here, for example?
#-moz-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
You're using a -moz- keyframe, which is fine, but notice anything else?
How about the -webkit- prefix on the transform?
So, in essence, this would become:
#-moz-keyframes spin {
from { -moz-transform: rotate(0deg); }
to { -moz-transform: rotate(360deg); }
}
Repeat this for your other keyframes and this should sort out a problem or two...
I am developing a mobile web application, and need to incorporate a loading spinner.
I have found one from a helpful website, and works on IE, FF and Chrome, but for some reason does not work on Safari on my iPhone 4.
HTML:
<div class="overlay">
<div class="loader">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
CSS:
.overlay {
opacity: 0.5;
background: #000;
width: 100%;
height: 100%;
z-index: 10;
top: 0;
left: 0;
position: fixed;
}
.loader {
width: 0px;
height: 0px;
margin: 50vh auto;
/*position: relative;*/
position: absolute;
left: 50%;
top: -100px;
}
.loader > div {
width: 6px;
height: 20px;
position: absolute;
left: -10px;
bottom: 15px;
border-radius: 5px;
transform-origin: 10px 35px;
transform: rotate(0deg);
animation: loader 0.8s infinite;
}
.loader > div:nth-child(2) {
transform: rotate(45deg);
animation-delay: 0.1s;
}
.loader > div:nth-child(3) {
transform: rotate(90deg);
animation-delay: 0.2s;
}
.loader > div:nth-child(4) {
transform: rotate(135deg);
animation-delay: 0.3s;
}
.loader > div:nth-child(5) {
transform: rotate(180deg);
animation-delay: 0.4s;
}
.loader > div:nth-child(6) {
transform: rotate(225deg);
animation-delay: 0.5s;
}
.loader > div:nth-child(7) {
transform: rotate(270deg);
animation-delay: 0.6s;
}
.loader > div:nth-child(8) {
transform: rotate(315deg);
animation-delay: 0.7s;
}
#keyframes loader {
0% {
background: transparent;
left: -10px;
transform-origin: 10px 35px;
}
30% {
background: white;
}
100% {
background: transparent;
left: 10px;
transform-origin: -10px 35px;
}
}
Plunker: http://plnkr.co/edit/ztBL6TN03yx41t4PRZMM?p=preview
Solution required prefixes, e.g:
.loader > div {
width: 6px;
height: 20px;
position: absolute;
left: -10px;
bottom: 15px;
border-radius: 5px;
-webkit-transform-origin: 10px 35px;
-moz-transform-origin: 10px 35px;
-ms-transform-origin: 10px 35px;
-o-transform-origin: 10px 35px;
transform-origin: 10px 35px;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-animation: loader 0.8s infinite;
-moz-animation: loader 0.8s infinite;
animation: loader 0.8s infinite;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes loader {
0% {
background: transparent;
left: -10px;
-webkit-transform-origin: 10px 35px;
-moz-transform-origin: 10px 35px;
transform-origin: 10px 35px;
}
30% {
background: white;
}
100% {
background: transparent;
left: 10px;
-webkit-transform-origin: -10px 35px;
-moz-transform-origin: -10px 35px;
transform-origin: -10px 35px;
}
}
Plunkr: plnkr.co/edit/ztBL6TN03yx41t4PRZMM?p=preview