@@ -28,6 +28,8 @@ function setup() {
2828 makeGrid ( rows , cols ) ;
2929 shapes = makeFlowers ( radius ) ;
3030 addSvgsToCells ( size , padding ) ;
31+ fixCellPosiiton ( ) ;
32+ addOnClickToCells ( ) ;
3133}
3234
3335function addSvgsToCells ( size , padding ) {
@@ -41,6 +43,41 @@ function addSvgsToCells(size, padding) {
4143 two . add ( shape ) ;
4244 two . update ( ) ;
4345 } ) ;
46+ // get position of cell, set position to fixed with left and right set
47+
48+ }
49+
50+ function fixCellPosiiton ( ) {
51+ $ ( ".cell" ) . each ( function ( i , o ) {
52+ $ ( this ) . parent ( ) . css ( { position : 'relative' } ) ;
53+ var top = $ ( this ) . offset ( ) . top , left = $ ( this ) . offset ( ) . left ;
54+ console . log ( top ) ;
55+ console . log ( left ) ;
56+ // console.log($(this).offset());
57+ $ ( this ) . css ( { top : top , left : left , position :'absolute' } ) ;
58+ // console.log($(this).offset());
59+ } ) ;
60+ // console.log($("#cell20").offset());
61+ }
62+
63+ function addOnClickToCells ( ) {
64+ $ ( '.cell' ) . click ( function ( ) {
65+ $ ( this ) . css ( 'transition' , 'scale()' ) ;
66+ var kiddo = this . children [ 0 ] ;
67+ if ( typeof kiddo !== 'undefined' ) {
68+ // Expand child SVG to 200px
69+ $ ( this ) . animate ( { width : "200px" } , 500 ) ;
70+ setTimeout ( function ( ) {
71+ // 500 ms later, expand height to 800px
72+ $ ( this ) . animate ( { height :"800px" } , 500 ) ;
73+ } , 500 ) ;
74+ setTimeout ( function ( ) {
75+ // 1s later show text
76+ // object.children.find
77+ } ) ;
78+ }
79+
80+ } ) ;
4481}
4582
4683function makeGrid ( rows , cols ) {
0 commit comments