avoid using transitions when the element is hidden because the `transitionend` event isn't fired by every browser for hidden elements and will result in the callback not being called