1

I'm trying to make something like fullpage.js. I have an active element and previous element. When I'm scrolling I have transform property on the both blocks, one like

.active {
transform: translateY(0);
opacity: 1;
transition: all 1s ease;
}

And another is

.previous {
transform: translateY(100vh);
opacity: 0;
transition: all 1s ease;
}

Without transition they appear in a moment without any delay. But when I add transition they starting to blink because of the opacity. How can I make the block first to transform and then to lose it's opacity

Kirill
  • 207
  • 1
  • 4
  • 14

1 Answers1

3

You can simply define multiple transitions:

div {
  width: 200px;
  height: 200px;
  background: orange;
  opacity: 0.5;
  transition: transform 0.5s ease 0s, opacity 0.5s ease 0.5s;
}

body:hover div {
  transform: rotate(45deg);
  opacity: 1;
}
<div></div>
Etheryte
  • 24,589
  • 11
  • 71
  • 116