Сергей Ракипов,
в x у вас бред!!!
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8">
<title>index</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
font-family: Verdana, Geneva CY, Helvetica, DejaVu Sans, Arial, sans-serif;
font-size: .8rem;
line-height: 160%;
}
.main{
max-width: 1024px;
margin: 0 auto;
}
.slider{
position: relative;
overflow: hidden;
width: 1024px;
height: 495px;
}
.slider_befor, .slider_after{
position: absolute;
top: 0;
left: 0;
width: inherit;
height: inherit;
overflow: hidden;
-webkit-transition: all easy .1s;
-o-transition: all easy .1s;
-moz-transition: al easyl .1s;
-ms-transition: all easy .1s;
transition: all easy .1s;
}
.slider_after{
width: 50%;
border-right: 1px solid #fff;
}
</style>
</head>
<body>
<div class="main">
<div class="slider">
<div class="slider_befor"><img src="https://rakipov.ru/files/picture_1.jpg" alt=""></div>
<div class="slider_after"><img src="https://rakipov.ru/files/picture_2.jpg" alt=""></div>
</div>
</div>
<script>
const slider = document.querySelector(".slider");
function sliderPic(event){
let x = event.offsetX;
console.log(x);
document.querySelector(".slider_after").style.width = x + "px";
}
slider.addEventListener("mousemove", sliderPic)
</script>
</body>
</html>