Browse Source

#96: + 'webkit' prefix

animation
RubaXa 10 years ago
parent
commit
8f029c3955
  1. 20
      Sortable.js
  2. 2
      Sortable.min.js

20
Sortable.js

@ -28,7 +28,6 @@
, lastEl , lastEl
, lastCSS , lastCSS
, lastRect
, activeGroup , activeGroup
@ -84,7 +83,7 @@
ghostClass: 'sortable-ghost', ghostClass: 'sortable-ghost',
ignore: 'a, img', ignore: 'a, img',
filter: null, filter: null,
animation: 150 animation: 0
}; };
// Set default options // Set default options
@ -387,6 +386,7 @@
if (ms) { if (ms) {
var currentRect = target.getBoundingClientRect(); var currentRect = target.getBoundingClientRect();
_css(target, 'transition', 'none');
_css(target, 'transform', 'translate3d(' _css(target, 'transform', 'translate3d('
+ (prevRect.left - currentRect.left) + 'px,' + (prevRect.left - currentRect.left) + 'px,'
+ (prevRect.top - currentRect.top) + 'px,0)' + (prevRect.top - currentRect.top) + 'px,0)'
@ -394,7 +394,7 @@
target.offsetWidth; // repaint target.offsetWidth; // repaint
_css(target, 'transition', 'transform ' + ms + 'ms'); _css(target, 'transition', 'all ' + ms + 'ms');
_css(target, 'transform', 'translate3d(0,0,0)'); _css(target, 'transform', 'translate3d(0,0,0)');
clearTimeout(target.animated); clearTimeout(target.animated);
@ -628,7 +628,9 @@
function _css(el, prop, val){ function _css(el, prop, val){
if( el && el.style ){ var style = el && el.style;
if( style ){
if( val === void 0 ){ if( val === void 0 ){
if( document.defaultView && document.defaultView.getComputedStyle ){ if( document.defaultView && document.defaultView.getComputedStyle ){
val = document.defaultView.getComputedStyle(el, ''); val = document.defaultView.getComputedStyle(el, '');
@ -636,9 +638,15 @@
else if( el.currentStyle ){ else if( el.currentStyle ){
val = el.currentStyle; val = el.currentStyle;
} }
return prop === void 0 ? val : val[prop]; return prop === void 0 ? val : val[prop];
} else { }
el.style[prop] = val + (typeof val === 'string' ? '' : 'px'); else {
if (!(prop in style)) {
prop = '-webkit-' + prop;
}
style[prop] = val + (typeof val === 'string' ? '' : 'px');
} }
} }
} }

2
Sortable.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save