diff --git a/src/modules/transition.js b/src/modules/transition.js index 64ff99d46..bad393d20 100755 --- a/src/modules/transition.js +++ b/src/modules/transition.js @@ -130,7 +130,12 @@ $.fn.transition = function() { } module.debug('Preparing animation', settings.animation); if(module.is.animating() && settings.queue) { - module.queue(settings.animation); + if(!settings.allowRepeats && module.has.direction() && module.is.occuring() && instance.queuing !== true) { + module.error(error.repeated); + } + else { + module.queue(settings.animation); + } return false; } if(module.can.animate) { @@ -540,6 +545,10 @@ $.fn.transition = function() { looping: function() { return $module.hasClass(className.looping); }, + occuring: function(animation) { + animation = animation || settings.animation; + return ( $module.hasClass(animation) ); + }, visible: function() { return $module.is(':visible'); }, @@ -766,9 +775,12 @@ $.fn.transition.settings = { onShow : function() {}, onHide : function() {}, + // whether animation can occur twice in a row + allowRepeats : false, + // animation duration - animation : 'fade', - duration : '700ms', + animation : 'fade', + duration : '700ms', // new animations will occur after previous ones queue : true, @@ -788,6 +800,7 @@ $.fn.transition.settings = { // possible errors error: { noAnimation : 'There is no css animation matching the one you specified.', + repeated : 'You specified the same animation to occur again while it was already occurring, preventing repeated animation', method : 'The method you called is not defined', support : 'This browser does not support CSS animations' }