Why are console.log(this) = window instead of the "wrapper"-div? I use a arrow function because that would bind this to the div?
const slider = document.querySelector(".wrapper");
let isDown = false;
slider.addEventListener('mousedown', () => {
console.log(this);
isDown = true;
slider.classList.add('active');
});
<!DOCTYPE html>
<html lang="sv">
<head>
<title>Drag and drop</title>
<meta charset="utf-8">
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="wrapper">
<div class="item item1">1</div>
<div class="item item2">2</div>
<div class="item item3">3</div>
<div class="item item4">4</div>
<div class="item item5">5</div>
</div>
<script src="main.js"></script>
</body>
</html>