Solved

css3 transitions

Posted on 2013-11-23
4
178 Views
Last Modified: 2013-11-24
When you hover over the object it will fade lighter.  But when you hover out it doesn't do a nice transition how would you do transition of hover out of the object

Here is a link to the code

http://bit.ly/1bf9q2q
0
Comment
Question by:stargateatlantis
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39672209
I could not get it to work with jsfiddle but in jsbin http://jsbin.com/iJUpagEv/1/edit?html,css,output it seems to work.  How does it work on your own site?
0
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 500 total points
ID: 39672687
if all you're doing it fading in and out, then you don't need to use animations. use transitions instead.

http://jsfiddle.net/DXs3X/

.issue{
    width:200px;
    height:259px;
    background:url('http://images.kmag.co.uk/assets/images/latestfeatures/2013/11/Modu120.jpg') 100%;
    position:relative;
}

.issue > a{
    background-color:rgba(0, 0, 0, 0); 
    height:100%;
    width:100%;
    position:absolute;
    bottom:0; 
    
   -moz-transition: all 2s; 
    -ms-transition: all 2s; 
-webkit-transition: all 2s; 
        transition: all 2s;
}

.issue > a:hover{
     background-color:rgba(255, 255, 255, 1);  
     opacity: 0.5;
    
}

Open in new window

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39672723
You just use a transition both direction:

.someclass {background-color:rgba(0, 0, 0, 0);
                    transition:background-color 2s ease;}

.someclass:hover {background-color:rgba(0,0, 0, 1);
                    transition:background-color 2s ease;}

You probably don't need the hyphen hack.  Chrome has supported it natively for the last 5 version; firefix for the last 9 versions and AFAIK there was never an implementation of the -ms- version and IE supports transitions since IE9.

Cd&
0
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 39672731
CD&,

not sure what you mean by both directions. The code I posted transitions in and out. you don't need the transition rule on the :hover. that doesn't make sense. The transition applies to the element, then what ever happens to that element (ie: the hover) gets transitioned according to the transition rule on the element.

as far as -ms-, that was just automatic typing. If it's not needed, that's great. Personally, I don't really care much about IE, and don't spend too much time worrying about what works in IE and what doesn't doesn't.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now