1

Transition must happen when we move from one value to another upon a event.

Here the visibility setting on an element:

.two {
  background-color: #9fa8da;
  position: absolute;
  visibility: hidden;
  transition: visibility 3ms ease-in;
}

Upon a button click, visibility is set to 'visible'

.two-show {
   visibility: visible;
}

However there is no animation effect.

Plnkr here:

http://plnkr.co/edit/4Fhb1Uj744BRwCDhebOP?p=info

2

2 Answers 2

2

Try adding this to .two{}:

-webkit-transition: visibility 30ms ease-in, -webkit-transform 3s;
-moz-transition: visibility 30ms ease-in;
-o-transition: visibility 30ms ease-in;

I wonder if 3ms is to fast?

Sign up to request clarification or add additional context in comments.

Comments

1

You can achieve the very same effect you want using the opacity property. Updated your plunker using this new approach. I also increased the transition time for the effect to be noticeable.

.two {
  background-color: #9fa8da;
  position: absolute;
  opacity: 0;
  transition: opacity 3s ease-in;
}

.two-show {
  opacity: 1;
}

2 Comments

I like this approach. Nice job
Beat you by 9 seconds :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.