[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

css3 transitions

Posted on 2013-11-23
4
Medium Priority
?
196 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 54

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 2000 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
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…
Suggested Courses

649 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