I have an issue with a custom range input which updates a div in real time for video seeking which can be seen in this HTML5 video demo.
When the hidden range input is dragged, the position of the custom div changes slightly towards each end of the custom bar and doesn't remain on top of the cursor.
Here is a simplified example and code: https://jsfiddle.net/Lk9d8gjh/
You can see that the slider range value is computed by the left part of the handle at the start and then the right part of the handle at the end. Is there anyway I can change this so the range value is computed from the center of the handle thus removing this 'laggy' feel. I would expect the custom div to remain directly on top of my cursor at all times.
I've attempted changing the width of the thumb with:
input[type=range]::-webkit-slider-thumb
But still no luck. Below is the simplified custom range input code.
.slider-track {
position: relative;
width: 100%;
height: 10px;
background-color: gray;
}
.slider {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 50%;
background: green;
}
.slider-input {
margin: 0;
padding: 0;
width: 100%;
}
<div class="slider-track">
<div class="slider"></div>
<input class="slider-input" type="range" max="100" min="0"/>
</div>
$('.slider-input').on('input', function(e) {
$('.slider').width(e.target.value + '%');
});