Intermediate
Choose on a click, not at the end of a drag
This page chooses the cube the moment the pointer goes down, so a drag that starts on the cube also chooses it. Choose on pointerup instead, and only when the pointer moved at most 6 px since it went down.
A tap on the cube writes cube into #result; a drag that starts on the cube leaves it as nothing.
What Check tests
- A tap on empty space writes nothing
- A drag that starts on the cube does not choose it
- A tap on the cube chooses it
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.