Solved

css3 transitions

Posted on 2013-11-23
4
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 53

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
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 customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

729 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