img:hover transition not matching given variable - css

http://coreytegeler.com/new/ click on the up arrow and hover over the figure to see what I'm talking about
Ok so I am trying to create an inversion effect on hover of the silhouette, I've gotten all the CSS to change accordingly and used some minor JS to replace the image but the fading transition for the image goes much quicker than everything else. Even when setting the time to far more than it should be it does not seem to effecting it.
You should be able to see my style sheet at the link below, it's pretty tiny but I figured I'd let you guys see it all instead of the specific lines I'm talking about because I believe there could be a conflict.
http://coreytegeler.com/new/css/style.css
#shadow {
width:33%;
-webkit-transition: all 2.2s ease-in-out;
-moz-transition: all 2.2s ease-in-out;
-o-transition: all 2.2s ease-in-out;
transition: all 2.2s ease-in-out;
}
#shadow:hover {
-webkit-transition: all 2.2s ease-in-out;
-moz-transition: all 2.2s ease-in-out;
-o-transition: all 2.2s ease-in-out;
transition: all 2.2s ease-in-out;
}

Your code is not working on :hover because you simply change source of img. CSS has nothing to do with it.
You can place image in a div and set other image as div's background-image. Then on hover just reduce opacity to 0.
Demo
EDIT
In future you can use CSS filter property. Currently its supported by just -webkit. It'll be as simple as
img {
filter: invert(100%);
}
and you're done. But currently its just
img {
-webkit-filter: invert(100%);`
/*-moz -o -ms all are unimplimented*/
}
Proof of concept (Use chrome or safari to see the effect)
+filter(W3C)

Related

CSS div fade when hovering over another element which is child of a sibling

I have a Wordpress website which uses the Dune theme from Zigzagpress.
You can check the site here.
What I want to do is, when hovering over an image, remove the grey layer that the post_image_overlay div has.
I've tried doing it by adding this custom css to the file provided in the theme to do so, custom.css, which gets loaded along with the theme's css:
.post_image_overlay {
opacity: 1;
transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-webkit-transition: opacity 1s ease-in-out;
}
.post_image_overlay:hover {
opacity: 0;
transition: opacity .55s ease-in-out;
-moz-transition: opacity .55s ease-in-out;
-webkit-transition: opacity .55s ease-in-out;
}
But this doesn't seem to make any difference. In fact, with the Chrome inspector and the custom.css file properly loaded, I can see my custom css rules in the .post_image_overlay (for example, if I change the opacity to 0.5, the background is not as dark), but I can't see the .post_image_overlay:hover anywhere. I've even tried to add it directly in the Chrome inspector, but it gets greyed out:
I'd post a JSFiddle but I believe the problem lies beneath some other CSS in the page which is conflicting with my custom one, so I guess it's better to check it live.
BONUS POINTS: Ideally, I'd love to have the background fading out only when the user hovered over the entry title (h2.entry-title), not all the image, but I don't really know if that can be done.
The reason it's not working is because your .entry-content-title has a z-index: 1002; style, which means it's sitting over the top of your .post_image_overlay and therefore you're not hovering over it.

CSS background-color transition not working in specific browsers (desktop + mobile)

I have this SCSS that, in theory, should transition the background color smoothly, but it is not smooth in specific browsers.
See this codepen for a demo: http://codepen.io/ahegyi/pen/Wvjajy
(Click on the photo or note text to activate the transition. It's more obvious if you click on the text.)
.overlay {
-webkit-transition: background-color 0.2s ease;
-moz-transition: background-color 0.2s ease;
-ms-transition: background-color 0.2s ease;
-o-transition: background-color 0.2s ease;
transition: background-color 0.2s ease;
background-color: rgba(0,0,0,0.3);
&.reveal {
background-color: rgba(0,0,0,0);
}
&.conceal {
background-color: rgba(0,0,0,0.7);
}
}
In Chrome desktop (version 42.0.2311.152, Mac OS 10.9) and Firefox desktop (version 36.0.4, Mac OS 10.9), the transitions are smooth.
However, in Safari (both desktop v7.1.3 + mobile Safari on iOS 8.1.3) and Chrome mobile on iOS (v 38.0.2125.59) do not transition, and instead snap directly.
Can anyone reproduce this issue? Is this a bug in certain versions of WebKit, or am I missing something here? Could it be that other transitions I use interact poorly with this particular transition? (In parallel, I'm also using a height transition on .mark-note-text h2, and a jQuery slide effect on the .mark-content div.)
The issue appears to be caused by a syntax error in your externally loaded CSS.
In this file, you will find this code.
.mark-object .overlay{-webkit-transition:background-color, 200ms, ease;-moz-transition:background-color, 200ms, ease;-ms-transition:background-color, 200ms, ease;-o-transition:background-color, 200ms, ease;transition:background-color, 200ms, ease;
Which looks like this beautified.
.mark-object .overlay {
-webkit-transition: background-color, 200ms, ease;
-moz-transition: background-color, 200ms, ease;
-ms-transition: background-color, 200ms, ease;
-o-transition: background-color, 200ms, ease;
transition: background-color, 200ms, ease;
As you can see, there are commas between the properties, the duration, and the easing function, but there should only be commas to delimit different properties.
Also, the CSS you have in your CodePen is less-specific than your external CSS, so it has no effect. If you were to increase the specificity, your pen would work.
You can see how Safari is error-handling this in the applied styles.
However, Firefox error handles it in a different way, assuming all for the bare settings.
We can see from the computed styles that non-iOS Chrome does the same as Firefox.
Of course, the reason Chrome behaves the same as Safari on iOS is because iOS Chrome uses the same rendering engine as Safari, as per Apple's requirement.

Site wide link fade EXCLUDING one element

I'm extremely novice when it comes to CSS. So forgive my probably very ignorant question.
I am working on adding a fade effect when hovering on links / menu items on my website. I've found a piece of code that does the trick which I've listed below. However, I am looking for a simple way to exclude this from affecting my main page content. This code is making the transition time on a slideshow choppy and slow. Is there a way to simply exclude this from affecting the main page content?
a {
-webkit-transition:all 200ms ease-in;
-o-transition:all 200ms ease-in;
}
Thank you!
Add another CSS rule with a more specific selector that overrides it and disables the transition. For example, if the link you want to exclude has an id of "slideshow-link":
a {
-webkit-transition: all 200ms ease-in;
-o-transition: all 200ms ease-in;
}
a#slideshow-link {
-webkit-transition: none 0ms ease;
-o-transition: none 0ms ease;
}
Or to exclude all links within a .content div:
.content a {
-webkit-transition: none 0ms ease;
-o-transition: none 0ms ease;
}

Why does using a webkit-transition with text result in the text snapping at the end?

Please see the following: http://jsfiddle.net/2Vdef/1/
When you move your mouse over the div, the text animates in but right at the end has a very unattractive snap into opacity:1. Why so abrupt? How can this be made smooth? Thanks
I've run into the same problem, and while this solution doesn't work in my case it does in yours.
http://jsfiddle.net/2Vdef/13/
Add backface-visibility.
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
EDIT: The solution in my case was indeed backface-visbility. You just need to apply it to the correct element. I animated the opacity of a, and assumed that backface-visbility needed to be applied to a. Instead, it needed to be applied to the container of a.
Not working: http://jsfiddle.net/9PmXu/
Fixed: http://jsfiddle.net/9PmXu/1/
It looks fine on Chrome and FF Win 7 / OS X to me, but on IE of course no gradual opacity change. For all browsers, you could try to achieve the same effect with jQuery and tweak the animation speed as you like. http://jsfiddle.net/2Vdef/8/
Try changing this:
-webkit-transition: opacity 1s ease;
-moz-transition: opacity 1s ease;
-o-transition: opacity 1s ease;
transition: opacity 1s ease;
To this:
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
It should just make all your transition problems be more smooth.
Also, the answer above from #Slave is correct also, but change the '200' to '600' to make it a bit more smooth. The answer is correct, but my answer is in pure CSS.
Turns out you can prevent the choppyness with:
-webkit-transform: translateZ(0);
http://chrissilich.com/blog/fix-css-animation-slow-or-choppy-in-mobile-browsers/

Fade in fade out on image hover using CSS3?

I was wondering if it was possible to state an unhover class at all on an image?
What I am trying to achieve is when someone hovers over an image it will fade in and then when they unhover it fades back out?
Heres my code, I got the fade in to work when someone hovers over an image but I need it too fade out when they unhover... hope this made sense.
http://jsfiddle.net/L7XCD/
This should work for you! http://jsfiddle.net/L7XCD/1/
Let's use the great mozilla documentation to explain this:
Transition rovide a way to control the speed of animation changes to CSS properties. Instead of having the animation changes take effect instantly, you can transition the property changes over a specified time period.
Also we used the transition timing functions (ease, linear, easy-in, easy-out, easy-in-out)
Timing functions determine how intermediate values of the transition are calculated. The timing function can be specified by providing the graph of the corresponding function, as defined by four points defining a cubic bezier
CCS markup:
img {
opacity: 0.6;
transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-webkit-transition: opacity 1s ease-in-out;
}
img:hover {
opacity: 1.0;
transition: opacity .55s ease-in-out;
-moz-transition: opacity .55s ease-in-out;
-webkit-transition: opacity .55s ease-in-out;
}​
Since he was using the transition ease-in-out, I thought it was better to use the same transition function.
For more information, check the documentation here
Hope it helps!
http://jsfiddle.net/L7XCD/2/
Just add the transition effect to your element without the hover-tag

Resources