visionmedia / move.js

CSS3 backed JavaScript animation framework
http://visionmedia.github.com/move.js/
4.72k stars 686 forks source link

Move#set(prop, val) when prop contain 'px' function not work #79

Closed dasoncheng closed 7 years ago

dasoncheng commented 8 years ago

Move.js version ge 0.4.0

/*not work*/
move('#example-1 .box')
  .set('margin-left', 200)
  .end();
/*work*/
move('#example-1 .box')
  .set('margin-left', '200px')
  .end();
// prop : margin-left width height  (prop have 'px')--- can not work
// prop : opacity color---is ok

Move.prototype.set

Move.prototype.set = function(prop, val){
  this.transition(prop);
  this._props[prop] = val;
  return this;
};

Move.prototype.add

Move.prototype.add = function(prop, val){
  if (!style) return;
  var self = this;
  return this.on('start', function(){
    var curr = parseInt(self.current(prop), 10);
    self.set(prop, curr + val + 'px');
  });
};