Open 7flash opened 2 years ago
Hi @7flash.
I literally just came here looking for the same as you. You are right: the mouseDownHandler
is unattached, but in the article page the demo works, right?
The answer is in this repo (or in the DevTools of the article page). If you visit the demo file in https://github.com/phuocng/html-dom/blob/master/assets/demo/drag-to-scroll/index.html, you'll find the missing bit right at the end of the <script>
:
// Attach the handler
ele.addEventListener('mousedown', mouseDownHandler);
Yes, I agree that the article should highlight this instead of leaving it to be found by the stubborn.
https://github.com/1milligram/html-dom/blob/master/posts/drag-to-scroll.md