CSS3 transition breaks in chrome on refresh - html

Looked around and haven't found anything similar - finding this really weird.
I have a simple animation on load for a menu at the bottom of a page, sliding the text up a couple seconds after loading (to allow other animations to finish). This works absolutely fine on firefox, IE, android browser and chrome for android. But when I test it on desktop Chrome (44), it doesn't quite work.
What happens is when I load the page for the first time (cleared cache/incognito) the animation will work. But every subsequent time I load the page, it will break - and I have no idea why.
This only happens when I wrap one of the spans in the div inside a link.
The animation is as so:
#-webkit-keyframes fadeInBottom {
0% {
opacity: 0;
-webkit-transform: translateY(15vw);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
#-moz-keyframes fadeInBottom {
0% {
opacity: 0;
-moz-transform: translateY(15vw);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
#keyframes fadeInBottom {
0% {
opacity: 0;
transform: translateY(15vw);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
the css for the spans:
.basePanel{
z-index:999;
height: 5vw;
width: 100vw;
position:absolute;
bottom:0;
font-size:4vw;
color:#f1f8f0;
display:inline-block;
font-family:coda, courier;
-webkit-animation-name: fadeInBottom;
-webkit-animation-fill-mode: both;
-webkit-animation-duration: 1.3s;
-webkit-animation-delay:1.8s;
-moz-animation-name: fadeInBottom;
-moz-animation-fill-mode: both;
-moz-animation-duration: 1.3s;
-moz-animation-delay:1.8s;
animation-name: fadeInBottom;
animation-fill-mode: both;
animation-duration: 1.3s;
animation-delay:1.8s;
}
#contact{
padding-top: 15vh;
position:relative;
font-family:coda, courier;
text-align:left;
color:#f1f8f0;
font-size:6vw;
}
.button{
position:relative;
text-align:center;
width:32.1vw;
-webkit-transition: background-color 0.3s linear;
-moz-transition: background-color 0.3s linear;
-o-transition: background-color 0.3s linear;
-ms-transition: background-color 0.3s linear;
transition: background-color 0.3s linear;
}
.button:hover{
background-color: #252c24;
-webkit-transition: background-color 0.5s linear;
-moz-transition: background-color 0.5s linear;
-o-transition: background-color 0.5s linear;
-ms-transition: background-color 0.5s linear;
transition: background-color 0.5s linear;
}
.centre{
width:32.15vw;
}
and relevant html:
<div class="basePanel">
<span class="left basePanel button">About</span>
<span class="centre basePanel button">Portfolio</span>
<a href="contact">
<span class="right basePanel button">Contact</span>
</a>
</div>
Here is a fiddle with the relevant HTML and CSS: https://jsfiddle.net/bqLLqbwc/
Annoyingly, this actually works in Chrome. To see the broken page, here is the actual web page I am working on: http://www.devox.org
I've tested on two computers, one running windows 7 and the other running ubuntu 14.04, both running chrome 44.

So I ended up restructuring the html a bit.
While it feels like wrapping a <div> tag in an <a> tag would be easier, it just doesn't seem to work in Chrome. Maybe it breaks some legacy bug from pre HTML5 days. I have no idea.
So instead I wrap an <a> tag in a <span> tag and change the css to make it fill the div and remove any decoration:
html:
<span class="right basePanel button">Contact</span>
css:
.button a{
color: #f1f8f0;
display:block;
height: 100%;
width: 100%;
text-decoration:none;
}
.button a:visited{color:#f1f8f0;}
Which seems to work fine.

Related

Making text show up on hover and blur effect blinking fix

/* CSS used here will be applied after bootstrap.css */
body{
background-color:yellow;
}
img{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
img:hover{
-webkit-filter:blur(5px);
}
<img src="http://i.stack.imgur.com/K0jNI.png">
When you hover over the image the borders of the image flash for a bit before settling.. Is there a way to fix that?
And how do i make a text show up on the middle of the image when i hover over it?
EDIT: This now looks great in Chrome
I don't think it's entirely possible to get a super clean transition when using webkit blur. I've had a lot of rendering issues and glitches when using it before. It's a resource hog too when used on a lot of elements. My advice to change your easing to linear and target only the blur. That should tighten it up a little bit.
img{
-webkit-transition: -webkit-filter 0.5s linear;
-moz-transition: -webkit-filter 0.5s linear;
-o-transition: -webkit-filter 0.5s linear;
-ms-transition: -webkit-filter 0.5s linear;
transition: -webkit-filter 0.5s linear;
}
As for the text fade in. You'll need to add in an element that is initially opacity:0; but then changed to opacity:1; when the parent block is hovered. Initial HTML changed to this:
<div class='block'>
<img src="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4">
<span>Hey there</span>
</div>
And the new CSS
/* CSS used here will be applied after bootstrap.css */
body {
background-color: yellow;
}
img {
-webkit-transition: -webkit-filter 0.5s linear;
transition: -webkit-filter 0.5s linear;
}
.block {
position: relative;
width: 400px;
}
.block img {
width: 100%;
}
.block span {
opacity: 0;
-webkit-transition: all .3s;
transition: all .3s;
color: white;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
text-align: center;
left: 0;
right: 0;
}
.block:hover > span {
opacity: 1;
}
img:hover {
-webkit-filter: blur(4px);
}
Example here
http://codepen.io/jcoulterdesign/pen/58d613e80e4a768cc9e54aa1e7aaa0af

CSS3 hover on/off effects in Chrome skip animation

So my hover effect works just fine in every browser including IE9+ and it does work in Chrome except hovering on/off the element in certain places can make it skip the animation and snap straight back to the starting positing instead of fading slowly.
This only happens with Chrome, is it a bug, or is there something I can add in my code to smooth things out for Chrome and make sure it always animates back to the default state instead of just jumping to it.
Its using an image with the following class attached to it, the image is also using shape-outside to form text around it so i've included all the CSS code below - the animation slightly rotates and tilts the device picture on hover.
.floatleft {
float:left;
width: 240px;
height: 341px;
-webkit-shape-outside: url(http://url.com/image.png);
-o-shape-outside: url(http://url.com/image.png);
shape-outside: url(http://url.com/image.png);
-webkit-shape-image-threshold: 0.5;
-o-shape-image-threshold: 0.5;
shape-image-threshold: 0.5;
-webkit-shape-margin: 20px;
-o-shape-margin: 20px;
shape-margin: 20px;
margin:20px;
display:inline-block;
-webkit-transition: 0.7s ease-in-out;
-moz-transition: 0.7s ease-in-out;
-ms-transition: 0.7s ease-in-out;
-o-transition: 0.7s ease-in-out;
transition: 0.7s ease-in-out;
transition-timing-function: linear;
}
.floatleft:hover, .floatleft:active
{
-webkit-transform:rotateX(-13deg) rotate(-5deg);
transform:rotateX(-13deg) rotate(-5deg);
-o-transform:rotateX(-13deg) rotate(-5deg);
-moz-transform:rotateX(-13deg) rotate(-5deg);
-ms-transform:rotateX(-13deg) rotate(-5deg);
-webkit-transition: 0.5s ease-in-out;
-moz-transition: 0.5s ease-in-out;
-o-transition: 0.5s ease-in-out;
-ms-transition: 0.5s ease-in-out;
transition: 0.5s ease-in-out;
}
Heres the Fiddle - http://jsfiddle.net/d5wnnqfd/

Fade out after div content has been shown using CSS

I'm trying to show a notification on button click. The button click actually checks for email validation. I know to show a div with content with the error message. However, I would like to fade out the error message, lets say after 5 seconds . I would like to achieve it using CSS. Below is my attempt, it just hides everything. Please advise.
#signup-response{
width: 50%;
margin-left: auto;
margin-right: auto;
text-align: center;
background-color: #FF0000;
margin-top: 20px;
-webkit-transition: opacity 5s ease-in-out;
-moz-transition: opacity 35s ease-in-out;
-ms-transition: opacity 5s ease-in-out;
-o-transition: opacity 5s ease-in-out;
opacity: 0;
}
You can use animation example.
Set the animation-delay to the time you want. Make sure you use animation-fill-mode: forwards to stop the animation.
#signup-response{
width: 50%;
margin-left: auto;
margin-right: auto;
text-align: center;
background-color: #FF0000;
margin-top: 20px;
animation:signup-response 0.5s 1;
-webkit-animation:signup-response 0.5s 1;
animation-fill-mode: forwards;
animation-delay:2s;
-webkit-animation-delay:1s; /* Safari and Chrome */
-webkit-animation-fill-mode: forwards;
}
#keyframes signup-response{
from {opacity :1;}
to {opacity :0;}
}
#-webkit-keyframes signup-response{
from {opacity :1;}
to {opacity :0;}
}
Using css3 keyframe animation:
(You'll probably want to add -webkit- -moz-, -ms-, and -o- prefixes on the animation and animation-delay properties inside .error-message and on the keyframes to support older browsers.)
.error-message {
animation: fadeOut 2s forwards;
animation-delay: 5s;
background: red;
color: white;
padding: 10px;
text-align: center;
}
#keyframes fadeOut {
from {opacity: 1;}
to {opacity: 0;}
}
<div class="error-message">
<p>Some random text</p>
</div>
cross browser hack (instead of using css3 animation keyframes):
transition-timing-function: cubic-bezier(1,1,1.0,0);}
-webkit-transition-timing-function: cubic-bezier(1,1,1.0,0);
http://www.w3schools.com/cssref/css3_pr_transition-timing-function.asp

CSS - tooltip only with css and html doesn't work

I am trying to do simple tooltip only with css3 and html, but the transition doesn't work. What am I doing wrong?
HTML
<p>
This has tooltip
</p>
<div class="tooltip">Tooltip content</div>
CSS
p {
width: 200px;
background-color: aqua;
padding: 10px;
margin-top: 50px;
}
div.tooltip {
position: absolute;
width: auto;
padding: 10px;
background-color: rgba(0,0,0, 0.5);
top: 0px;
display: none;
opacity: 0.0;
transition: opacity 1s;
-webkit-transition: opacity 1s;
-o-transition: opacity 1s;
-moz-transition: opacity 1s;
}
p:hover + div.tooltip {
display: block;
opacity: 1.0;
transition: opacity 1s;
-webkit-transition: opacity 1s;
-o-transition: opacity 1s;
-moz-transition: opacity 1s;
}
http://jsfiddle.net/MCDg4/
Update / Alternate solution
For a modern browser CSS3 solution you could use pseudo elements..
<span data-tooltip="I am the tooltip">This has a tooltip</span>
and
[data-tooltip]{
position:relative;
}
[data-tooltip]:before{
content:attr(data-tooltip);
position:absolute;
bottom:110%;
padding:10px;
background:#666;
opacity:0;
color:white;
font-size:smaller;
-webkit-transition:opacity 1s ease;
-o-transition:opacity 1s ease;
transition:opacity 1s ease;
pointer-events:none;
}
[data-tooltip]:hover:before{
opacity:1;
}
Demo at http://jsfiddle.net/BJ2tr/
(this could be done without pseudo-elements by nesting the tooltip inside the elements that it refers to, and adjusting the css accordingly)
Unfortunately when you change display from none to something else, you cannot have transitions.
Instead of display:none you could just offset it outside of the window (with top:-9999px) and bring it to position when showing it.
div.tooltip {
position: absolute;
width: auto;
padding: 10px;
background-color: rgba(0,0,0, 0.5);
top: -999px; /*CHANGED THIS AND REMOVED display:none*/
display: none;
opacity: 0.0;
transition: opacity 1s;
-webkit-transition: opacity 1s;
-o-transition: opacity 1s;
-moz-transition: opacity 1s;
}
p:hover + div.tooltip {
opacity: 1.0;
top: 0px; /*ADDED THIS AND REMOVED display:block*/
transition: opacity 1s;
-webkit-transition: opacity 1s;
-o-transition: opacity 1s;
-moz-transition: opacity 1s;
}
This will, however, not fade out (only in) since it moves it away on mouseout (so it actually does fade but you do not see it because it is outside the viewport)..
Explanation
You put transition only on opacity, while when changing to display:block; it is shown as a block with opacity:1; by default.
Solution
(JSFiddle)
Delete the display:none; and display:block on your tooltip element.

CSS Transition on Hover

I have a problem. I actually try to do a transition at a div when I hover the mouse over an object. So basically I have a div, and when I hover my mouse the div, it should display another div at the top of it, however it should be transitioned, so the hover effect would be smoother.
How is it possible, if I have these two divs?
<div id="first">
<div id="on-hover">
<img src="example-image.png" />
</div>
</div>
You use CSS3 transition:
#on-hover {
opacity:0;
/* Firefox */
-moz-transition-property: opacity;
-moz-transition-duration: 2s;
-moz-transition-delay: 1s;
/* WebKit */
-webkit-transition-property: opacity;
-webkit-transition-duration: 2s;
-webkit-transition-delay: 1s;
/* Opera */
-o-transition-property: opacity;
-o-transition-duration: 2s;
-o-transition-delay: 1s;
/* Standard */
transition-property: opacity;
transition-duration: 2s;
transition-delay: 1s;
}
#on-hover:hover {
opacity:1;
}
The complete thing working: http://jsfiddle.net/djwave28/CuNkZ/2/
More information can be read here: http://robertnyman.com/2010/04/27/using-css3-transitions-to-create-rich-effects/
I do need to explicitly mention that this may not work in IE9 and below. IE10 seems to work according top the docs. If needed, you can simulate the effect with javascript, but the question was CSS.
#on-hover {
opacity: 0;
transition: opacity 0.5s;
-webkit-transition: opacity 0.5s;
}
#first:hover #on-hover {
opacity: 1;
}
This is only about the animation. A more detailed example here: http://jsfiddle.net/ELa6X/
i quickly mocked up something that could do it with css3 transitions demo jsfiddle
#on-hover {
transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
-webkit-transition: opacity .25s ease-in-out;
opacity:0;
}
By smoother do you mean fade in? Here is an example of fading in on #on-hover. I use pointer-events:none to ignore hover on <img> and pass the event on to its parent #on-hover.
jsFiddle
#first,
#on-hover {
width:100px;
height:100px;
}
#first {
background-color:#F00;
}
#on-hover {
opacity:0;
background-color:#0F0;
-webkit-transition:opacity .5s ease;
-moz-transition:opacity .5s ease;
transition:opacity .5s ease;
}
#on-hover:hover {
opacity:1;
}
#on-hover img {
pointer-events:none;
}
Use the pseudo selector :hover.
#first:hover > #on-hover{
opacity:1;
}
#on-hover{
opacity:0;
-webkit-transition: opacity 0.5s;
}
#first{
width:300px;
height:200px;
}
http://jsfiddle.net/charlescarver/V8PK3/1/
I'd suggest using jQuery and animate(). You could do with CSS but then you'd have problems with older browsers.