javascript-tutorial/fr.javascript.info

interrupting the ball displacement when the cursor go off zone

Closed this issue · 0 comments

This will fix the bug that keeps the ball to follow the cursor when going off the container zone.
At this moment you need to reload the page to get rid of this bug.

Just add this :

document.addEventListener('mouseout', function() {
        ball.dispatchEvent(new Event('mouseup'));
});

You may need to adapt document to the container that you use in your example.