When animating an element to disappear with opacity: 0, then setting the display property to 'none' to remove it from view, display:none gets executed instantly, is there anyway to wait for the animation to complete before removing it from view with display:none
Here is the following example: http://jsfiddle.net/zg3q7jLt/38/
var box = document.querySelector('#box');
function addCssTransition(elem, speed) {
                elem.style.cssText +=
                    ';transition: all ' + speed + 's ease-in-out; ' +
                    '-moz-transition: all ' + speed + 's ease-in-out;' +
                    '-webkit-transition: all ' + speed + 's ease-in-out';
}
function fadeOut(elem, speed){
        addCssTransition(elem, speed);
        elem.style.opacity = 0;
        elem.style.display = 'none';
}
fadeOut(box, 0.75);
 
     
     
    