I use this CSS code for create a hover for images in bootstrap but this hover is not work on IOS safari and chrome browser . it is working on android . i want to know where am i wrong and what should i do ?
.hovereffect {
width:100%;
height:100%;
float:left;
overflow:hidden;
position:relative;
text-align:center;
cursor:default;
}
.hovereffect .overlay {
width:100%;
height:100%;
position:absolute;
overflow:hidden;
top:0;
left:0;
opacity:0;
background-color:rgba(130,139,164,0.5);
-webkit-transition:all .4s ease-in-out;
-moz-transition: all .4s ease-in-out;
-o-transition:all .4s ease-in-out;
transition:all .4s ease-in-out;
}
.hovereffect img {
display:block;
position:relative;
-webkit-transition:all .4s linear;
transition:all .4s linear;
-moz-transition:all .4s linear;
-o-transition:all .4s linear;
}
.hovereffect h2 {
color:#fff;
text-align:center;
position:relative;
font-size:17px;
background:rgba(41,35,92,0.8);
-webkit-transform:translateY(-100px);
-ms-transform:translateY(-100px);
-moz-transform: translateY(-100px);
-o-transform: translateY(-100px);
transform:translateY(-100px);
-webkit-transition:all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition:all .2s ease-in-out;
transition:all .2s ease-in-out;
padding:10px;
}
.hovertext {
color:#fff;
text-align:center;
position:relative;
font-size:17px;
padding:10px;
}
.hovereffect a.info {
text-decoration:none;
display:inline-block;
color:#fff;
border:1px solid #fff;
background-color:transparent;
opacity:0;
filter:alpha(opacity=0);
-webkit-transition:all .2s ease-in-out;
-moz-transition:all .2s ease-in-out;
-o-transition:all .2s ease-in-out;
transition:all .2s ease-in-out;
padding:7px 14px;
}
.hovereffect a.info:hover {
box-shadow:0 0 5px #fff;
}
.hovereffect:hover img {
-ms-transform:scale(1.2);
-webkit-transform:scale(1.2);
-moz-transform: scale(1.2);
-o-transform: scale(1.2);
transform:scale(1.2);
border-radius: 15px;
}
.hovereffect:hover .overlay {
opacity:1;
filter:alpha(opacity=100);
cursor: pointer;
visibility: visible;
}
.hovereffect:hover h2,.hovereffect:hover a.info {
opacity:1;
filter:alpha(opacity=100);
-ms-transform:translateY(0);
-webkit-transform:translateY(0);
-moz-transform: scale(1.2);
-o-transform: scale(1.2);
transform:translateY(0);
}
.hovereffect:hover a.info {
-webkit-transition-delay:.2s;
-moz-transition-delay: .2s;
-o-transition-delay: .2s;
transition-delay:.2s;
}
#rounded {
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
}
.rounded {
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
}
You need to use the :focus selector for iOS. Just add it to your classes the same way you would the :hover selector.
Related
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;
}
}
}
I am having a hard time figuring out how to have my mobile menu icon animate on click. It would be ideal if I could click the menu icon and the menu would just slide in using animate.css fadeInDown and then when clicked again to exit the menu if it used animate.css fadeOutUp. Is there any way to do this using JS too? I really want to learn.
Here is the html:
<header>
<div id="pic-1">
<img id="top" src="css/Unknown.png" class="log animated fadeInDown">
<nav>
<a class="burger-nav animated fadeInDown"><i class="fas fa-bars"></i>
</a>
<ul class="li animated fadeInDown">
<li><a>Home</a></li>
<li><a>About Us</a></li>
<li><a>Contact Us</a></li>
<li><a>Volunteer</a></li>
</ul>
</nav>
</div>
</header>
Here is the CSS (media queries):
/* Mobile 1 */
#media only screen and (min-width : 320px) {}
.checkBox {
display: none;
}
.logo {
display: none;
}
.log {
position: fixed;
z-index: 999;
left: -2%;
height: 10%;
width: 35%;
padding-top: 2%;
padding-right: 33%;
padding-left: 33%;
border: solid white;
background-color: white;
}
.burger-nav {
position: fixed;
z-index: 999;
left: 85%;
top: 1%;
font-size: 300%;
}
header nav ul {
overflow: hidden;
height: 0;
margin-top: 70px;
width: 100%;
margin-left: -40px;
position: fixed;
z-index: 999;
}
header nav ul.open {
height: auto;
}
header nav ul li {
text-align: center;
width: 100%;
margin: 0;
list-style-type: none;
font-family: Jazz LET, fantasy;
font-size: 17px;
word-spacing: 7px;
letter-spacing: 5px;
font-weight: bold;
}
header nav ul li a:hover {
}
header nav ul li a {
color: #FF6103;
padding: 10px;
border-bottom: 1px solid white;
display: block;
background-color: black;
opacity: .5;
}
.li {
-webkit-animation-duration: 1s;
-webkit-animation-delay: 1s;
-webkit-animation-iteration-count: 1;
-moz-animation-duration: 1s;
-moz-animation-delay: 1s;
-moz-animation-iteration-count: 1;
-o-animation-duration: 1s;
-o-animation-delay: 1s;
-o-animation-iteration-count: 1;
animation-duration: 1s;
animation-delay: 1s;
animation-iteration-count: 1;
}
.fas {
color: purple;
}
#pic-1 {
background-size: 120% 100%;
}
#pic-2 {
background-size: 123% 100%;
}
#pic-3 {
background-size: 120% 100%;
}
.social {
display: none;
}
.circle {
display: none;
}
}
And here is some JS I've used:
$(document).ready(function(){
$(".burger-nav").on("click", function(){
$("header nav ul").toggleClass("open")
});
});
I hope someone can help! Thank you!
Well css-animations are a bit tricky. But nothing that can't be solved. First of all you should use #keyframes. A good explanation can be found here. The trick is to toggle two classes (.open and .close) which will handle your opening and closing animation. Important is the animation-fill-mode attribute to keep your animation sticking with it's final state. Also you can not use height: auto; because it needs to be a real value. max-height: 1000px; will do the trick. So you animate from max-height: 0; to max-height: 1000px; and vice versa. Here is your simplified code as a runnable snippet:
$(document).ready (function() {
$('.burger-nav').on ('click', function () {
//check if class open is already set then toggle
if ($('header nav ul').hasClass ('open'))
$('header nav ul').toggleClass ('close open');
else {
$('header nav ul').removeClass ('close');
$('header nav ul').addClass ('open');
}
});
});
header nav ul {
overflow: hidden;
max-height: 0; //<-- this needs to be changed
margin-top: 70px;
width: 100%;
margin-left: -40px;
position: fixed;
z-index: 999;
}
header nav ul li {
text-align: center;
width: 100%;
margin: 0;
list-style-type: none;
font-family: Jazz LET, fantasy;
font-size: 17px;
word-spacing: 7px;
letter-spacing: 5px;
font-weight: bold;
}
header nav ul li a {
color: #FF6103;
padding: 10px;
border-bottom: 1px solid white;
display: block;
background-color: black;
opacity: .5;
}
.li {
-webkit-animation-duration: 1s;
-webkit-animation-delay: 1s;
-webkit-animation-iteration-count: 1;
-moz-animation-duration: 1s;
-moz-animation-delay: 1s;
-moz-animation-iteration-count: 1;
-o-animation-duration: 1s;
-o-animation-delay: 1s;
-o-animation-iteration-count: 1;
animation-duration: 1s;
animation-delay: 1s;
animation-iteration-count: 1;
}
header nav ul.open {
animation-name: open;
animation-name: open;
animation-fill-mode: forwards;
}
#keyframes open {
from {max-height: 0;}
to {max-height: 1000px;}
}
header nav ul.close {
animation-name: close;
animation-name: close;
animation-fill-mode: both;
}
#keyframes close {
from {max-height: 1000px;}
to {max-height: 0;}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<header>
<nav>
click_me
<ul class="li animated fadeInDown">
<li><a>Home</a></li>
<li><a>About Us</a></li>
<li><a>Contact Us</a></li>
<li><a>Volunteer</a></li>
</ul>
</nav>
</header>
I develop in Django framework. In IOS, Safari I have a bug with input cursor in markup like in this screenshot (cursor is outside input control when I type text in control):
. Other browsers look good - no bug. I have a following html code in my project:
<form id="loginForm" name="authorization">
{% verbatim %}
<div class="error-message" ng-if="wrongUserPass" id="authErrorPath">{{ loginErrorMess }}</div>
{% endverbatim %}
<div class="form-group form-field-group_inline" ng-if="!user_is_authenticated && auth_step1">
<input class="form-field signinPhone with_ccode" id="id_phone" ng-model="loginForm.loginPhone" bad-gentlemen-mask="+7 (***) ***-**-**" autocomplete="off" name="phone" placeholder="телефон" type="text" my-enter="" value='' {% if mobile == True %} scroll-on-focus {% endif %} />
</div>
</form>
Cursor appears like here, but I don't understnand how to fix this issue.
Following css code (from chrome developer tools) corresponds input control with id=id_phone:
.form-field:focus, .form-field:hover {
box-shadow: 0 6px 10px rgba(0,0,0,.1);
}
#media (max-width: 767px) {
.login__mobile .form-field {
width: 260px!important;
margin: 0 auto;
}
}
#media (max-width: 767px) {
.login__mobile .form-field {
padding: 6px 10px!important;
}
.login__mobile .form-field {
padding: 0 12px!important;
border-radius: 6px;
}
}
#media (max-width: 767px) {
.form-field {
font-size: 1.5rem;
}
.form-field {
border: 3px solid #dfecf5;
border-radius: 10px;
font-size: 2.083333333333333rem;
font-weight: 300;
padding: 5px 12px;
width: 100%;
outline: 0;
-webkit-transition: all .3s ease;
transition: all .3s ease;
background-color: #fff;
color: #31323a;
}
.form-field, .form-label_block {
display: block;
}
}
button, input, select, textarea {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
input {
line-height: normal;
}
button, input, optgroup, select, textarea {
margin: 0;
font: inherit;
color: inherit;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
input:not([type]), input[type="email" i], input[type="number" i], input[type="password" i], input[type="tel" i], input[type="url" i], input[type="text" i] {
padding: 1px 0px;
}
input {
-webkit-appearance: textfield;
background-color: white;
-webkit-rtl-ordering: logical;
cursor: text;
padding: 1px;
border-width: 2px;
border-style: inset;
border-color: initial;
border-image: initial;
}
input, textarea, select, button {
text-rendering: auto;
color: initial;
letter-spacing: normal;
word-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
display: inline-block;
text-align: start;
margin: 0em;
font: 400 13.3333px Arial;
}
input, textarea, select, button, meter, progress {
-webkit-writing-mode: horizontal-tb;
}
.login__mobile {
color: #fff;
display: none;
padding: 0;
}
.navbar_menu-show .top-menu_mobile {
visibility: visible;
opacity: 1;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
-o-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
.top-menu_mobile {
display: none;
visibility: hidden;
opacity: 0;
position: fixed;
top: 0;
right: 0;
height: 100%;
width: 100%;
padding: 5px 15px;
z-index: 1000;
background-color: rgba(0,0,0,.9);
-webkit-transition: all.3s ease;
-o-transition: all.3s ease;
transition: all .3s ease;
text-align: center;
overflow: scroll;
}
body, html {
font: 400 12px 'Open Sans',sans-serif;
line-height: 1.333333333333333;
color: #1e252b;
overflow-x: hidden;
}
body, html {
font: 400 12px 'Open Sans',sans-serif;
line-height: 1.333333333333333;
color: #1e252b;
overflow-x: hidden;
}
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
:after, :before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
:after, :before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
Please, help, who knows. Thanks.
Privet Alexander, I had the same problem. This is an iOS bug that occurs if your <input> field is in a container (div etc) with the css property position: fixed. I had my <body> tag css'ed with position: fixed and had to change it to something else, i.e. to position: absolute.
Some other workarounds are described here:
https://hackernoon.com/how-to-fix-the-ios-11-input-element-in-fixed-modals-bug-aaf66c7ba3f8
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
How do I get this code to work on iOS?
My iPad won't show the translate property.
I have read about using -webkit-backface-visibility: hidden; and -webkit-transform: translate3d, but its not working.
.logo-box {
display: inline-block;
vertical-align:middle;
width:115px;
margin: 0px 10px 0px 10px;
-webkit-transition: .7s;
-moz-transition: .7s;
-o-transition: .7s;
-ms-transition: .7s;
transition: .7s;
}
.logo-box:hover {
transform: translate(0,-20px);
-webkit-transform: translate(0,-20px); /** Safari & Chrome **/
-o-transform: translate(0,-20px); /** Opera **/
-moz-transform: translate(0,-20px); /** Firefox **/
-webkit-transition: .5s;
-moz-transition: .5s;
-o-transition: .5s;
-ms-transition: .5s;
transition: .5s;
}
In some cases, adding perspective helped me out. You may want to try adding it and see it if works. You can read about it here:
http://www.w3schools.com/cssref/css3_pr_perspective.asp