<script>
let before_afters = document.querySelectorAll('.before-after');
before_afters.forEach(function (before_after) {
let divisor = before_after.querySelector(".img-before"),
handle = before_after.querySelector("#handle"),
slider = before_after.querySelector("#track");
slider.oninput = function () {
moveDivisor();
}
function moveDivisor() {
handle.style.left = slider.value + "%";
divisor.style.width = slider.value + "%";
}
window.onload = function () {
moveDivisor();
};
});
</script>