Permalink
Browse files

Only set/get transition related css when required

  • Loading branch information...
1 parent ff50088 commit 43adc29f42c997c7ac3a5f741da0b5bd14f0b2f1 @jsor committed May 8, 2013
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/core_plugin.js
View
15 src/core_plugin.js
@@ -397,11 +397,17 @@
return;
}
- var backup = list.css(['transitionDuration', 'transitionTimingFunction', 'transitionProperty']),
+ var complete = opts.complete || $.noop,
+ css = {};
+
+ if (transitions) {
+ var backup = list.css(['transitionDuration', 'transitionTimingFunction', 'transitionProperty']),
+ oldComplete = complete;
+
complete = function() {
$(this).css(backup);
- (opts.complete || $.noop).call(this);
- },
+ oldComplete.call(this);
+ };
css = {
transitionDuration: (duration > 0 ? duration / 1000 : 0) + 's',
transitionTimingFunction: option.easing || opts.easing,
@@ -416,6 +422,7 @@
})() : 'none',
transform: 'none'
};
+ }
if (transforms3d) {
css.transform = 'translate3d(' + (properties.left || 0) + ',' + (properties.top || 0) + ',0)';
@@ -425,7 +432,7 @@
$.extend(css, properties);
}
- if (duration > 0) {
+ if (transitions && duration > 0) {
list.one('transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd', complete);
}

1 comment on commit 43adc29

@mironeasav

Thanks for your effort !

Please sign in to comment.