Created
July 8, 2014 14:09
-
-
Save tatey/3f1933d2d6d8b4dbe801 to your computer and use it in GitHub Desktop.
A JavaScript work-around for http://stackoverflow.com/questions/24472945/css-transition-stutters-after-being-applied-to-element-with-css-animation/24476506#24476506
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = angular.module 'dashboard' | |
app.animation '.appear', [-> | |
addClass: (element, className, done) -> | |
$element = jQuery element | |
$element.removeClass className | |
$element.css 'opacity', 1 | |
$element.animate {opacity: 0}, 300, 'linear', -> | |
$element.addClass className | |
done() | |
(isCancelled) -> | |
$element.stop() if isCancelled | |
removeClass: (element, className, done) -> | |
$element = jQuery element | |
$element.css 'opacity', 0 | |
$element.animate {opacity: 1}, 200, 'linear', done | |
(isCancelled) -> | |
$element.stop() if isCancelled | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment