move stuff to js/utils

This commit is contained in:
Adam Bradley
2013-10-01 10:45:20 -05:00
parent 7386f3f468
commit a0a720988d
9 changed files with 166 additions and 167 deletions

44
js/utils/animate.js Normal file
View File

@ -0,0 +1,44 @@
(function(ionic) {
ionic.Animator = {
animate: function(element, className, fn) {
return {
leave: function() {
var endFunc = function() {
console.log('Animation finished for element', element);
element.classList.remove('leave');
element.classList.remove('leave-active');
element.removeEventListener('webkitTransitionEnd', endFunc);
element.removeEventListener('transitionEnd', endFunc);
};
element.addEventListener('webkitTransitionEnd', endFunc);
element.addEventListener('transitionEnd', endFunc);
element.classList.add('leave');
element.classList.add('leave-active');
return this;
},
enter: function() {
var endFunc = function() {
console.log('Animation finished for element', element);
element.classList.remove('enter');
element.classList.remove('enter-active');
element.removeEventListener('webkitTransitionEnd', endFunc);
element.removeEventListener('transitionEnd', endFunc);
};
element.addEventListener('webkitTransitionEnd', endFunc);
element.addEventListener('transitionEnd', endFunc);
element.classList.add('enter');
element.classList.add('enter-active');
return this;
}
};
}
};
})(ionic);