Browse Source

Transition: prevents same animation from occurring twice by default

pull/524/head
jlukic 11 years ago
parent
commit
4dcfe8aa40
1 changed files with 16 additions and 3 deletions
  1. 19
      src/modules/transition.js

19
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'
}

Loading…
Cancel
Save