0
我試圖按照Logarithmic slider的示例進行操作。對數滑塊返回NaN
下面是我使用的代碼:
Timeline._MIN_PER_MINUTE = 1;
Timeline._MIN_PER_HOUR = Timeline._MIN_PER_MINUTE * 60.0;
Timeline._MIN_PER_DAY = Timeline._MIN_PER_HOUR * 24.0;
Timeline._MIN_PER_WEEK = Timeline._MIN_PER_DAY * 7.0;
Timeline._MIN_PER_MONTH = Timeline._MIN_PER_WEEK * 4.0;
Timeline._MIN_PER_YEAR = Timeline._MIN_PER_MONTH * 12.0;
var scale_down = 0.00001;
var scale_up = 100000;
Timeline._SLIDER_MIN = 0;
Timeline._SlIDER_MAX = 100;
Timeline._SLIDER_STEP = 1;
Timeline._scale = function (value) {
var minIn = Timeline._SLIDER_MIN;
var maxIn = Timeline._SLIDER_MAX;
var minOut = Math.log(Timeline._MIN_PER_MINUTE);
var maxOut = Math.log(Timeline._MIN_PER_YEAR);
var scale = (maxOut - minOut)/(maxIn - minIn);
return Math.exp(minOut + scale * (value - minIn));
};
Timeline._sliderChangedHandler = function(id){
var val = Timeline._scale($('#scale_slider' + id).val());
alert(val);
};
出於某種原因,我得到NaN的結果。 有人知道我在做什麼錯嗎?
我還拿到NaN。 – lowerkey 2011-01-25 05:47:47