1

I have an element. On hover it goes opacity: 0; in 500ms. After 500ms I need to make it to display:none;.

Is this possible by using transition-delay on the display property?

.myEl {
transition: opacity 500ms, display 0ms ease 500ms;
opacity: 1;
display: block;
}

.myEl:hover {
display:none;
opacity:0;
}

This code above doesn't work for me :(

Fiddle here: http://jsfiddle.net/onvpn995/

morkro
  • 4,336
  • 5
  • 25
  • 35
Blagoh
  • 1,225
  • 1
  • 14
  • 29

1 Answers1

-3

If you use "display:none"; you will not be able to have a transition. You Can use following:

.myEl {
transition: opacity 500ms;
opacity: 1;
display: block;
}

.myEl:hover {
opacity: 0;
visibility:hidden;
}

(as visibility:hidden; has almost the same effect as display:none)

Prashant
  • 446
  • 1
  • 4
  • 15