鍍金池/ 問答/HTML/ js滑塊取最大值和最小值問題

js滑塊取最大值和最小值問題

const minwidth = (this.$refs.progress.clientWidth / barwidth + this.percentum) * this.percentmax // 10 - 90

const maxwidth = this.$refs.progress.clientWidth / barwidth * this.percentmax // 0 - 80

minwidth 滑動取到的是10-90,maxwidth 滑動取到的是0-80 ,怎么取10-80

回答
編輯回答
別硬撐
minwidth = (minwidth-10) * (8/9) + 10;
maxwidth = maxwidth * (8/9) + 10;

可以拿已知的這個范圍通過計算換算成目標范圍啊

2017年12月19日 17:31