@@ -12,29 +12,26 @@ function setup() {
1212 var width = $ ( 'body' ) . width ( ) ;
1313 var size = 150 ;
1414 var padding = 50 ;
15- var rows = Math . floor ( height / size ) ;
16- var cols = Math . floor ( width / size ) ;
17- var radius = Math . floor ( Math . max ( width , height ) / Math . max ( rows - 1 , cols - 1 ) ) / 2 ;
1815
1916 var isMobile = window . matchMedia ( "only screen and (max-width: 450px)" ) . matches ||
2017 / A n d r o i d | w e b O S | i P h o n e | i P a d | i P o d | B l a c k B e r r y | I E M o b i l e | O p e r a M i n i / i. test ( navigator . userAgent ) ;
2118 var isOtherMediaQuery = window . matchMedia ( "only screen and (min-width:1080px)" ) . matches ;
2219 if ( isMobile && ! isOtherMediaQuery ) {
23- size = 300 ;
24- padding = 80 ;
25- radius = Math . floor ( height / rows - 3 ) ;
20+ size = 250 ;
21+ padding = 250 ;
2622 }
23+ var rows = Math . floor ( height / size ) ;
24+ var cols = Math . floor ( width / size ) ;
25+ var radius = Math . floor ( Math . max ( width , height ) / Math . max ( rows - 1 , cols - 1 ) ) / 2 ;
2726
28- console . log ( width ) ;
29- console . log ( isMobile ) ;
30- console . log ( rows ) ;
31- console . log ( cols ) ;
32- console . log ( radius ) ;
33-
27+ if ( isMobile && ! isOtherMediaQuery ) {
28+ radius = Math . floor ( height / ( rows + 2 ) ) ;
29+ }
30+
3431 makeGrid ( rows , cols ) ;
3532 shapes = makeFlowers ( radius ) ;
3633 addSvgsToCells ( size , padding ) ;
37- offsetEvenRows ( size ) ;
34+ offsetEvenRows ( size + padding ) ;
3835}
3936
4037function addSvgsToCells ( size , padding ) {
@@ -54,7 +51,7 @@ function offsetEvenRows(size) {
5451 $ ( ".row" ) . each ( function ( index , object ) {
5552 if ( index % 2 ) {
5653 $ ( object ) . css ( "position" , "relative" ) ;
57- $ ( object ) . css ( "left" , size / 2 * - 1 + "px" ) ;
54+ $ ( object ) . css ( "left" , size / 2 * - 1 + "px" ) ;
5855 }
5956 } ) ;
6057}
0 commit comments