File tree 1 file changed +2
-13
lines changed
1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -9,22 +9,11 @@ function JQCode() {
9
9
for ( var i = 0 ; i < 9 ; i ++ ) {
10
10
for ( var j = 0 ; j < 9 ; j ++ ) {
11
11
let $tileElement = $ ( '<div class="tile"></div>' ) ;
12
+ let randomColor = '#' + Math . floor ( Math . random ( ) * 12323232 ) . toString ( 16 ) ;
12
13
$tileElement . css ( 'width' , '11.1%' ) ;
13
14
$tileElement . css ( 'float' , 'left' ) ;
14
15
$tileElement . css ( 'paddingBottom' , '11.1%' ) ;
15
- if ( i % 2 === 0 ) {
16
- if ( j % 2 === 0 ) {
17
- $tileElement . css ( 'background' , 'salmon' ) ;
18
- } else {
19
- $tileElement . css ( 'background' , 'rebeccapurple' ) ;
20
- }
21
- } else if ( i % 2 !== 0 ) {
22
- if ( j % 2 === 0 ) {
23
- $tileElement . css ( 'background' , 'rebeccapurple' ) ;
24
- } else {
25
- $tileElement . css ( 'background' , 'salmon' ) ;
26
- }
27
- }
16
+ $tileElement . css ( 'background' , randomColor ) ;
28
17
$tileElement . css ( 'margin' , 'auto' ) ;
29
18
$ ( 'body' ) . append ( $tileElement ) ;
30
19
}
You can’t perform that action at this time.
0 commit comments