a1exlism
11/26/2017 - 3:01 AM

js_type_NaN

var pos = parseInt(element.style.right.replace(/px|vw/gi, ''));
//  if right === 0; return NaN

Resolution:

var pos = parseInt(element.style.right.replace(/px|vw/gi, '') + 0);


利用弱类型转换  依然存在bug, '90' + 0 = '900'

var nowRight = element.style.right;
var pos;
if (!nowRight) {
  pos = parseInt(element.style.right.replace(/px|vw/gi, ''));
} else {
	pos = 0;
}