JSFiddle - React, Tailwind, and code Playground
HTML
<div id="scroll">
<div id="scroll-inner">
<img src="http://placehold.it/250x150"/>
<img src="http://placehold.it/250x150"/>
<img src="http://placehold.it/250x150"/>
<img src="http://placehold.it/250x150"/>
<img src="http://placehold.it/250x150"/>
<img src="http://placehold.it/250x150"/>
<img src="http://placehold.it/250x150"/>
</div>
</div>
<input type="range" min="0" max="100" step="0.01" value="0">
CSS
* {
margin: 0;
padding: 0;
}
body {
background: #DDE6EA;
}
#scroll {
height: 150px;
width: 100%;
overflow: hidden;
}
#scroll #scroll-inner {
height: 150px;
overflow: visible;
float: left;
width: 10000%;
}
#scroll img {
display: block;
float: left;
}
input[type=range] {
-webkit-appearance: none;
margin: 50px 0;
width: 100%;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 1px;
cursor: pointer;
animate: 0.2s;
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
background: #CCD2E8;
border-radius: 100%;
border: 0px solid #000101;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
border: 0px solid #000000;
height: 39px;
width: 39px;
border-radius: 100%;
background: white;
cursor: pointer;
-webkit-appearance: none;
margin-top: -19.6px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #CCD2E8;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 1px;
cursor: pointer;
animate: 0.2s;
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
background: #CCD2E8;
border-radius: 100%;
border: 0px solid #000101;
}
input[type=range]::-moz-range-thumb {
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
border: 0px solid #000000;
height: 39px;
width: 39px;
border-radius: 100%;
background: white;
cursor: pointer;
}
input[type=range]::-ms-track {
width: 100%;
height: 1px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-color: transparent;
border-width: 39px 0;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #ac51b5;
border: 0px solid #000101;
border-radius: 100%;
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
}
input[type=range]::-ms-fill-upper {
background: #ac51b5;
border: 0px solid #000101;
border-radius: 100%;
box-shadow: 0px 0px 0px...
JavaScript
var range = document.querySelector("input[type=range]");
var scroll = document.querySelector("#scroll");
var scrollInner = document.querySelector("#scroll-inner");
var imgs = document.querySelectorAll("img");
range.onchange = range.oninput = function()
{
//scroll.scrollLeft = scrollInner.offsetWidth * (range.value / 100); //Раскоментировать, если нужен обчный скролл.
scroll.scrollLeft = (250 * (imgs.length) - scroll.offsetWidth) * (range.value / 100);
console.log(scrollInner.offsetWidth);
}