File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 4
4
( function ( ) {
5
5
"use strict" ;
6
6
7
- var SQUARE_SIZE = 75 ;
7
+ var SQUARE_SIZE = 50 ;
8
8
var MOVEMENT_STEP = 3 ;
9
9
10
10
var requestAnimationFrame = window . requestAnimationFrame || window . mozRequestAnimationFrame ||
52
52
var top = parseInt ( square . style . top , 10 ) ;
53
53
var right = left + SQUARE_SIZE ;
54
54
var bottom = top + SQUARE_SIZE ;
55
-
55
+
56
56
switch ( direction ) {
57
57
case 37 : // left
58
58
if ( left > 0 ) {
59
- square . style . left = left - MOVEMENT_STEP ;
59
+ square . style . left = left - MOVEMENT_STEP + 'px' ;
60
60
}
61
61
break ;
62
62
case 38 : // up
63
63
if ( top > 0 ) {
64
- square . style . top = top - MOVEMENT_STEP ;
64
+ square . style . top = top - MOVEMENT_STEP + 'px' ;
65
65
}
66
66
break ;
67
67
case 39 : //right
68
68
if ( right < document . documentElement . clientWidth ) {
69
- square . style . left = left + MOVEMENT_STEP ;
69
+ square . style . left = left + MOVEMENT_STEP + 'px' ;
70
70
}
71
71
break ;
72
72
case 40 : // down
73
73
if ( bottom < document . documentElement . clientHeight ) {
74
- square . style . top = top + MOVEMENT_STEP ;
74
+ square . style . top = top + MOVEMENT_STEP + 'px' ;
75
75
}
76
76
break ;
77
77
default :
You can’t perform that action at this time.
0 commit comments