html-dom icon indicating copy to clipboard operation
html-dom copied to clipboard

mouseDownHandler is not attached to listener

Open 7flash opened this issue 1 year ago • 2 comments

7flash avatar Jul 24 '22 12:07 7flash

https://github.com/1milligram/html-dom/blob/master/posts/drag-to-scroll.md

7flash avatar Jul 24 '22 12:07 7flash

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.

ricardo-reis-1970 avatar Mar 02 '23 10:03 ricardo-reis-1970