question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transitioning children elements

See original GitHub issue

Vue.js version

1.0.26

Reproduction Link

http://jsfiddle.net/0gmusue5/

Steps to reproduce

  • Click on the button to open the slider (OK)
  • Click on the darkened zone on the left to close the slider (FAIL) -> The element is never removed. (We can’t click on the body anymore, in that case)

What is Expected?

The element should be removed after animation.

What is actually happening?

The element is not removed from the DOM. (afterLeave is never called)

More details

Note: I had to add the CSS transition: all 2s; to the class .slider-transition. Otherwise VueJS doesn’t know about the transition time.

Improvement

I feel like the way I’m using the transition system is a bit “hacky” although I have no idea how to avoid it. Ideally I’d like to be able to call transitions as follow:

<div id="slider" v-if="opened">
  <div id="slider-backdrop" @click="$emit('close')" transition="fade"></div>
  <div id="slider-content" transition="slide"></div>
</div>

But the transition attribute is only allowed at the v-if level.

Did I miss something ? What do you think ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
Elfayercommented, Aug 23, 2016

Here is a “trick” I found to make it work : http://jsfiddle.net/0gmusue5/1/

The solution is still to add a false transition to the VueJS transitioned element and add a false attribute opacity: 0.999 to make it work (opacity: 1 doesn’t work, I guess there needs to be a transition in a way). It still feels like a hack to me. Any advice or opinion about this ?

.slider-transition {
  transition: all 1s; // trick
  #slider-backdrop {
    transition: opacity .5s;
    opacity: .5;
  }
  #slider-content {
    transition: transform 1s;
    transform: translateX(36px);
  }
}

.slider-enter, .slider-leave {
  opacity: 0.999; // trick
  #slider-backdrop {
    opacity: 0;
  }
  #slider-content {
    transform: translateX(calc(100% + 36px));
  }
}
0reactions
yyx990803commented, Jan 22, 2017

This will be a wontfix in 1.x, and should be addressed in 2.x via the ability to explicitly declare transition durations (#4371)

Read more comments on GitHub >

github_iconTop Results From Across the Web

html - How to add a CSS3 transition to a child element when ...
I have created a simple layout above that shows the concept of what I am trying to achieve. What I want to do...
Read more >
Child Animations Have To Inherit Transition-Property In ...
As you can see, the static child elements, in AngularJS 1.2, basically has to inherit all transition-related values. AngularJS 1.4 makes this a ......
Read more >
HTML : CSS transition on child element where parent toggles ...
HTML : CSS transition on child element where parent toggles display property [ Beautify Your Computer ...
Read more >
Key Elements of Early Transition - Texas Education Agency
This document provides a framework of the key elements of early transition to assist LEAs and ECI contractors in developing a collaborative child...
Read more >
CSS transition animation fails when parent element changes ...
I wanted to change parent node position from static to fixed and at the same time animate some properties of child element using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found