I am unable to translate the bar_position using javascript.
slider3.oninput = function() {
output3.innerHTML = this.value;
bar_position.style.transform='translate(0)';
}
See the Pen Position Gauge by John (@johnkelton) on CodePen.
I am unable to translate the bar_position using javascript.
slider3.oninput = function() {
output3.innerHTML = this.value;
bar_position.style.transform='translate(0)';
}
See the Pen Position Gauge by John (@johnkelton) on CodePen.
You have three numbers:
start,value, andend. You can get the percentagevalueis betweenstartandendwith the following equation:You can then convert that percentage to the UI by multiplying by the width of the element, which is hardcoded to be
50.834pixels in the codepen: