I've two divs positioned absolutly and I position them relative to each other. When width
of one is change, then i recalculate and set positions. While I use css3 transition on 'width
' property, when i try to get 'width
' of animated one, it gives me the current value on dom. But i want to get the target value of transition to set positions correctly on begin of transition effect. Is this possible to get the target value via javascript or other ways?
EDIT
Below is a jsfiddle demonstrates my issue. It alerts '100px' but I need to get '300px'.
http://jsfiddle.net/Mdbgs/
Thanks.
Transitioning two or more properties You can transition two (or more) CSS properties by separating them with a comma in your transition or transition-property property. You can do the same with duration, timing-functions and delays as well. If the values are the same, you only need to specify one of them.
Specifically around properties, like transition properties, that are not inherited by default. Run this demo in my JavaScript Demos project on GitHub. First off, this is not an AngularJS-specific problem (as you might be lead to believe from the post title). This is just a byproduct of CSS behavior.
The transition-delay property specifies a delay (in seconds) for the transition effect.
It does not show fixed valency.
That's because .css('width')
is calling getComputedStyle
on the element, which does return the transitioning value. If you did directly access the style, you would get what you just had set:
document.getElementById('transition_div').style.width
$('#transition_div').prop('style').width
$('#transition_div')[0].style.width
(updated fiddle)
You could use the transitionend
event: (see for equivalent prefixed vendor)
$('#transition_div').css('width', 300).on("transitionend", function () {
alert($(this).css('width'));
});
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With