This is a small example of using pressing-and-holding on a div
to shrink the div
(which otherwise grows without bound).
Modify the code so that:
- …the circle doesn't extend over the edge of the page as it grows
- …it uses CSS transforms to animate its growth/shrinkage rather than JavaScript
- …it shrinks in proportion to the frequency of your clicks
- This stepping stone using JavaScript to listen for mouse events.
- MDN's reference on
MouseEvent
s - MDN's guide on "Using CSS Transforms"
- MDN's reference on
transform
- MDN's explanation of
border-radius