CSS animation does not work on iPhone/iOS12.2 - ios

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>

Related

.class:hover .otherClass {...} - iOS Safari not work

I've tried to do animations on hover with animate.css . Everything works, on desktop (safari, chrome) and mobile too(chrome), but not in Safari(iOS).
iOS Chrome | iOS Safari
//main flexbox
.ref {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
align-content: center;
}
//flexbox child
.ref-content {
height: 350px;
//background: grey;
width: 50%;
transition: 0.75s;
background-size: cover !important;
}
// flexbox text
.ref-text {
text-align: center;
display: none;
position: relative;
transition: 2.5s !important;
width: 100%;
height: 100%;
-webkit-animation: fadeIn 1s;
animation: fadeIn 1s;
h1 {
position: relative;
top: 30%;
display: block;
text-transform: uppercase;
padding-bottom: 10px;
// animate css použitý ako hover
-webkit-animation: fadeInLeft 1.5s;
animation: fadeInLeft 1.5s;
}
p {
position: relative;
top: 30%;
font-size: 1.5em;
// animate css použitý ako hover
-webkit-animation: fadeInLeft 1.75s;
animation: fadeInLeft 1.75s;
opacity: 0.75;
}
a {
display: block;
position: relative;
top: 35%;
// animate css použitý ako hover
-webkit-animation: fadeInLeft 2s;
animation: fadeInLeft 2s;
text-decoration: none;
background: #fff;
color: black;
max-width: 15%;
padding: 10px 0;
border-radius: 25px;
}
}
// ref 1
//ref1 background
.ref-content:nth-child(1) {
background-image: url('http://lavenderforluck.co/wp-content/uploads/2019/02/modern-home-office-desks-desk-designs-executive-options-for-ergonomics-sydney.jpg');
}
.ref-content:nth-child(1):hover .ref-text {
display: block;
color: #fff;
// fadeIn color overlay
-webkit-animation: fadeIn 1.5s;
animation: fadeIn 1.5s;
background: rgba(purple, 0.75);
}
// ref 2
.ref-content:nth-child(2) {
background-image: url('http://lavenderforluck.co/wp-content/uploads/2019/02/modern-home-office-desks-desk-designs-executive-options-for-ergonomics-sydney.jpg');
}
.ref-content:nth-child(2):hover .ref-text {
display: block;
color: #fff;
-webkit-animation: fadeIn 1s;
animation: fadeIn 1s;
background: rgba(black, 0.75);
}
<!-- referencie -->
<div class="ref">
<div class="ref-content">
<div class="ref-text">
<h1>RIVER VIEW RESIDENCE BRATISLAVA</h1>
<p>#web #webdesign #forms #campaing</p>
Zobraziť
</div>
</div>
<div class="ref-content">
<div class="ref-text">
<h1>RIVER VIEW RESIDENCE BRATISLAVA</h1>
<p>#web #webdesign #forms #campaing</p>
Zobraziť
</div>
</div>
</div>
Can someone help me to solve my problem?
I've tried to do animations.
I would be glad, if someone can resolve my problem
Any error message, everything is in screenshot :-)
I've tried lot of options to solve my problem but any of them didnt work well...
I was looking for some answers on stackoverflow too, but i didnt find any answer with problem like this...
You will need to create an overlay! and also in class .ref-text you can "play" with opacity:0; and not with the display: none;.
//scss code
.ref-content{
position: relative;
.ref-text{
opacity: 0;
position: relative;
z-index: -1;
}
&:before {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
background: rgba(0, 0, 0, 0.35); //put your rgba color here
-webkit-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
content: '';
z-index: -1;
}
&:hover{
&:before{
opacity: 1;
-webkit-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
}
.ref-text{
opacity: 1;
position: relative;
z-index: 1;
-webkit-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
}
}
}

asp.net mvc razor slip checkbox can not hit to check

I have problem with my View in asp.net mvc project. I added new checkboxFor element on this view:
<div class="col-md-6">
<div class="form-group">
<div class="checkbox clip-check check-primary">
#Html.CheckBoxFor(x => x.IsHomePage)
<label for="isHomePage">
Is Home Page
</label>
</div>
</div>
</div>
And this is my css:
.clip-check {
margin-bottom: 10px;
margin-top: 10px;
padding-left: 0;
}
.clip-check label {
cursor: pointer;
display: inline-block;
font-size: 13px;
margin-right: 15px;
padding-left: 30px !important;
position: relative;
line-height: 23px;
transition: border 0.2s linear 0s, color 0.2s linear 0s;
white-space: nowrap;
}
.clip-check label:before {
background-color: #ffffff;
border: 1px solid #c8c7cc;
content: "";
display: inline-block;
height: 20px;
left: 0;
margin-right: 10px;
position: absolute;
width: 20px;
border-radius: 0;
top: 1px;
transition: border 0.2s linear 0s, color 0.2s linear 0s;
}
.clip-check label:after {
display: inline-block;
font-size: 11px;
height: 19px;
left: 4px;
position: absolute;
top: -1px;
transition: border 0.2s linear 0s, color 0.2s linear 0s;
width: 19px;
}
.clip-check input[type="checkbox"] {
display: none;
}
.clip-check input[type="checkbox"]:checked + label:before {
border-width: 10px;
}
.clip-check input[type="checkbox"]:checked + label:after {
color: #fff;
content: "\f00c";
font-family: "FontAwesome";
}
.clip-check input[type="checkbox"][disabled] + label {
opacity: 0.65;
}
.clip-check input[type="checkbox"][disabled] + label:before {
background-color: #F8F8F8;
}
but after built and check from browser, I am not able to hit to check this checkbox, even I have done successfully with other checkbox as well. I am using bootstrap. Much appreciate to any help, thank you.
I have just checked carefully your css, you wrote everything for label element. You already hided checkbox input and draw the rectangle by css as well. Please see this code:
.clip-check label {
cursor: pointer;
display: inline-block;
font-size: 13px;
margin-right: 15px;
padding-left: 30px !important;
position: relative;
line-height: 23px;
transition: border 0.2s linear 0s, color 0.2s linear 0s;
white-space: nowrap;
}
.clip-check label:before {
background-color: #ffffff;
border: 1px solid #c8c7cc;
content: "";
display: inline-block;
height: 20px;
left: 0;
margin-right: 10px;
position: absolute;
width: 20px;
border-radius: 0;
top: 1px;
transition: border 0.2s linear 0s, color 0.2s linear 0s;
}
.clip-check label:after {
display: inline-block;
font-size: 11px;
height: 19px;
left: 4px;
position: absolute;
top: -1px;
transition: border 0.2s linear 0s, color 0.2s linear 0s;
width: 19px;
}
So if your label is not pointed to exactly the checkbox input with Id is IsHomePage (what will be rendered from asp.net server) then the style will not be changed :after. So your problem here :
<label for="isHomePage">
Please change isHomePage to IsHomePage, because of name of your field is IsHomePage.

CSS3 Animations, iOS Scrolling Issues

I've read quite a few SO posts on iOS scrolling issues, I'm aware a few people have had issues. I've tried numerous fixes but I'm absolutely stuck on this!
I'm making a one page website. The layout is a 3D cube, using CSS3 transforms and animations. In a nutshell, the problem is the content on the front face will scroll, the content on other faces wont. As far as I can tell this breaks when I rotate the faces to create the cube. The content in the right face will not scroll, it acts like overflow: hidden;
I don't know how useful this will be, but I've created an Fiddle. It uses on part of the code (the main idea) and the whole lot is quite a bit to post. Has anyone tried to get overflow content to scroll on iOS inside a rotated/transformed parent element before?
I'm going crazy, please help! Thanks!
Here's my SASS from the Fiddle;
body {
margin: 0;
padding: 0;
}
.cube-container {
width: 100%;
perspective: 2000px;
-webkit-perspective: 2000px;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0,0,0);
.cube-shell {
position: relative;
z-index: 1;
margin: 0 auto;
transform-style: preserve-3d;
transform: rotateY( 0deg ) translateX( 0px );
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0,0,0);
animation-duration: 1s;
animation-direction: normal;
animation-fill-mode: forwards;
animation-timing-function: ease;
&.rotate-center-to-right {
animation-name: center-to-right;
}
}
.face {
background-position: 50% 50%;
background-size: cover;
padding: 0;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0,0,0);
position: relative;
z-index: 10;
text-align: center;
width: 100%;
// When we are in "cube mode"
&.cube-compatible {
overflow: hidden;
position: absolute;
// z-index: 5;
top: 0;
left: 0;
right: 0;
// z-index: 0;
}
> .face-inner {
overflow: scroll;
// -webkit-overflow-scrolling: touch;
}
}
.face-inner {
max-width: 1320px;
max-height: 100%;
height: 100%;
width: 100%;
padding: 40px 60px;
margin: auto;
// display: inline-block;
display: block;
vertical-align: middle;
position: relative;
z-index: 30;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
// Center face
.face-center {
position: relative;
text-align: center;
background: #ccc;
}
// Right face
.face-right {
transform-origin: center right;
background: #efefef;
}
.scroll-content {
overflow: scroll;
-webkit-overflow-scrolling: touch;
height: 100%;
}
.scrollable {
-webkit-backface-visibility: hidden;
}
}
#keyframes center-to-right {
0% {
transform: rotateY( 0deg ) scale3d( 1, 1, 1 );
}
// 15% {
// transform: rotateY( 0deg ) scale3d( 0.90, 0.90, 0.90 ) translateY( 50px );
// }
// 75% {
// transform: rotateY( -90deg ) scale3d( 0.90, 0.90, 0.90 ) translateY( 50px );
// }
100% {
transform: rotateY( -90deg ) scale3d( 1, 1, 1 );
}
}
https://jsfiddle.net/fkb241ys/14/

CSS spinner/loading icon does not display on Safari/iPhone

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

Is it possible to create a cool transition/animation the eBay tablet app uses with regular HTML/CSS?

For those of you who have ever used the eBay app on a tablet device, you may have noticed that when you touch a product, the product view switches from a standard grid view like the following:
To a view like the following where all the products are moved to a left nav and the details about the touched product are put in the right area:
The thing that's really cool is the animation that transforms the view from one to the other.
Specifically, the product images shrink down a bit and then slide over to wherever they belong in the left nav. (This is much easier to see with the actual app than for me to explain.)
Anyway, I really like the animation, and I'd love to be able to create the same effect on a website using HTML/CSS, but I've had no luck.
I tried placing a bunch of divs next to each other on the screen and (with the click of a button) using CSS3 transitions to shrink the width of the containing div, but all that resulted in was the divs making a sudden jump from one location to another without any sort of fluid animation or movement, which I would ideally like.
If what I'm looking to achieve is impossible with just HTML/CSS, then that's fine, but I'd like to defer the question to those much wiser than me before I give you.
If anyone knows how to do this (or can conclusively tell me that it's impossible), I'd be very appreciative.
Thank you.
It is not difficult, just a little boring to do all the details
for this html
<div class="container">
<div id="elem1"></div>
<div id="elem2"></div>
<div id="elem3"></div>
<div id="elem4"></div>
<div id="elem5"></div>
<div id="elem6"></div>
<div id="elem7"></div>
<div id="elem8"></div>
<div id="elem9"></div>
</div>
I have prepared this CSS
.container {
position: relative;
width: 300px;
height: 300px;
border: 1px solid green;
}
.container div {
position: absolute;
width: 100px;
height: 100px;
border: 1px solid red;
background-color: lavender;
}
#elem5 {
left: 100px;
top: 100px;
}
.container:hover div {
-webkit-animation-duration: 3s;
-webkit-animation-direction: normal;
-webkit-animation-fill-mode: forwards;
}
#elem5 {
left: 100px;
top: 100px;
}
.container:hover #elem5 {
-webkit-animation-name: an5;
}
#-webkit-keyframes an5 {
0% {-webkit-transform: scale(1);}
50% {-webkit-transform: scale(0.33);}
100% {-webkit-transform: translateX(-133px) scale(0.33);}
}
#elem9 {
left: 200px;
top: 200px;
}
.container:hover #elem9 {
-webkit-animation-name: an9;
}
#-webkit-keyframes an9 {
0% {-webkit-transform: scale(1);}
50% {-webkit-transform: scale(0.33);}
100% {-webkit-transform: translateX(-233px) translateY(33px) scale(0.33);}
}
I have set an array of 9 elements, that would fit an 3x3 grid.
And I have positioned the 5th and 9th of them where they should be, and created an animation to move them to the list position.
(Only webkit transforms)
There is left to create animations for the other 7 elements, and to elaborate the animations (with more keyframes)
jfiddle
As per your comment, an alternate way to do it.
The demo is prepared for a grid of 3 columns. Then, the key is to have only the first child of every 3 in flow; the remaining 2 are out of flow since they are positioned absolute. This allows us to create generic rules based in nth-child for the positioning of the elements.
Once you have the animations set, this style adapts to any number of elements (and you have only to set as many animations as columns has your design)
CSS
.container {
height: 500px;
}
.child {
width: 100px;
height: 100px;
font-size: 40px;
text-align: center;
line-height: 90px;
box-shadow: inset 0px 0px 2px black;
}
.child:nth-child(3n+1) {
background-color: lightblue;
}
.child:nth-child(3n+2) {
position: absolute;
-webkit-transform: translate3d(100px, -100px, 0px);
background-color: lightgreen;
}
.child:nth-child(3n) {
position: absolute;
-webkit-transform: translate3d(200px, -100px, 0px);
background-color: lightyellow;
}
.container:hover .child {
-webkit-animation-fill-mode: forwards;
-webkit-animation-duration: 8s;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: linear;
width: 300px;
}
.container:hover .child:nth-child(3n+1) {
-webkit-animation-name: ani1;
}
.container:hover .child:nth-child(3n+2) {
-webkit-animation-name: ani2;
}
.container:hover .child:nth-child(3n+3) {
-webkit-animation-name: ani3;
}
#-webkit-keyframes ani1 {
0% {width: 100px; -webkit-transform: scale(1);}
50% {width: 300px; -webkit-transform: translate3d(-70px, -20px, 0px) scale(0.33);}
100% {width: 300px; -webkit-transform: translate3d(-100px, -40px, 0px) scale(0.33);}
}
#-webkit-keyframes ani2 {
0% {width: 100px;-webkit-transform: translate3d(100px, -100px, 0px) scale(1);}
50% {width: 300px; -webkit-transform: translate3d(0px, -90px, 0px) scale(0.33);}
100% {width: 300px; -webkit-transform: translate3d(-100px, -106px, 0px) scale(0.33);}
}
#-webkit-keyframes ani3 {
0% {width: 100px; -webkit-transform: translate3d(200px, -100px, 0px) scale(1);}
50% {width: 300px; -webkit-transform: translate3d(80px, -100px, 0px) scale(0.33) rotate(180deg);}
100% {width: 300px; -webkit-transform: translate3d(-100px, -73px, 0px) scale(0.33) rotate(359.99deg);}
}
Reusable fiddle
(Only for webkit. Just for fun, added some rotation)
On an iPad you can do this with the CSS -webkit-transform property.
CSS
.menu-open {
-webkit-transform: translate3d(260px, 0, 0);
}
#main {
-webkit-transition: -webkit-transform 150ms ease-in;
transition: -webkit-transform 150ms ease-in;
overflow: visible;
width: 100%;
margin: 0;
padding: 0;
outline: 0;
border: 0;
top: 0;
left: 0;
position: absolute;
color: #333;
background-color: white;
display: block;
min-height: 100%;
}
#menu
{
position: absolute;
width: 100%;
position: absolute;
width: 259px;
top: 0;
left: 0;
background: white;
margin: auto;
min-height: 100%;
height:auto !important;
height:100%;
overflow: hidden !important;
display:block;
}
HTML
<div id="menu" style="display:none; background-color: #cccccc;">
<div>Text</div>
</div>
<div id="main">
<input type="button" id="menuToggle" value="Toggle" />
</div>
JS
function showMenu() {
$("#menu").show(0);
$("#main").addClass('menu-open');
}
function hideMenu() {
if ($("#main").hasClass('menu-open')) {
$("#main").removeClass('menu-open');
setTimeout(function () { $("#menu").hide(); }, 500);
}
}
$(document).ready(function () {
var body = $("#main"),
menuToggle = $('#menuToggle'),
menu = $("#menu");
menuToggle.bind('click', function (ev) {
ev.preventDefault();
if (body.hasClass('menu-open')) {
hideMenu();
} else {
showMenu();
}
});
});
See this JsFiddle for an example. Hope I understood you correctly (no iPad here at the moment).

Resources