File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed
Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,19 @@ const reset = async () => {
3030 console . error ( "Error during storage removal:" , error ) ;
3131 }
3232}
33+
3334// JavaScript
3435var clickElement = document . getElementById ( 'click' ) ;
3536
36- clickElement . addEventListener ( 'click' , function ( ) {
37- // Remove the pop class and force a reflow to allow the animation to be restarted mid-animation
38- this . classList . remove ( 'pop' ) ;
39- void this . offsetWidth ;
40- this . classList . add ( 'pop' ) ;
37+ clickElement . addEventListener ( 'mousedown' , function ( ) {
38+ this . classList . add ( 'scale-down' ) ;
39+ } ) ;
40+
41+ clickElement . addEventListener ( 'mouseup' , function ( ) {
42+ this . classList . remove ( 'scale-down' ) ;
43+ } ) ;
44+ clickElement . addEventListener ( 'mouseleave' , function ( ) {
45+ this . classList . remove ( 'scale-down' ) ;
4146} ) ;
4247
4348run ( ) ;
Original file line number Diff line number Diff line change 2828 cursor : pointer;
2929 height : auto;
3030 width : auto;
31+ transition : all 0.1s ease-in-out;
3132}
3233
3334.text-layer {
@@ -51,12 +52,6 @@ body {
5152}
5253
5354/* CSS */
54- .pop {
55- animation : pop 0.3s ;
56- }
57-
58- @keyframes pop {
59- 0% { transform : scale (1 ); }
60- 50% { transform : scale (1.2 ); }
61- 100% { transform : scale (1 ); }
55+ .scale-down {
56+ transform : scale (0.8 );
6257}
You can’t perform that action at this time.
0 commit comments