[英]Simple JavaScript Slider - Need some OOP help to make it work
我正在使用純JavaScript創建自己的滑塊庫。 在這里看看:
http://jsfiddle.net/bingo14/bhymxrqr/1/
我試圖從getValue()函數返回最新的“ currentValue”,但是從初始警報中可以看到它返回0。
this.getValue = function getValue() {
//how do I return the latest current value?
return currentValue;
};
每當用戶移動滑塊時,如何使它更新? 我想在這里需要有關OOP原則的幫助!
謝謝。
“它確實更新,我添加了setInterval(function(){console.log(mySlider.getValue())},1000);然后每秒返回當前值”
我沒有正確測試! Alex K.說對了
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.