|
44 | 44 | <body> |
45 | 45 |
|
46 | 46 | <div id="code-example" style="display:none"> |
47 | | - // Box object names. |
48 | | - var boxGray, boxRed, boxOrange |
49 | | - |
| 47 | + // First running function. |
50 | 48 | var start = function() { |
51 | 49 |
|
52 | 50 | // BOX: Gray box. Parameters: (left, top, width, height) |
53 | | - boxGray = createBox(0, 0, 120, 120) |
| 51 | + page.boxGray = createBox(0, 0, 120, 120) |
54 | 52 | that.color = "lightgray" |
55 | 53 | that.center() |
56 | 54 |
|
57 | 55 | // BOX: Red box. |
58 | | - boxRed = createBox(0, 0, 120, 120) |
| 56 | + page.boxRed = createBox(0, 0, 120, 120) |
59 | 57 | that.color = "orangered" |
60 | | - that.aline(boxGray, "right", 4) |
| 58 | + that.aline(page.boxGray, "right", 4) |
61 | 59 |
|
62 | 60 | // BOX: Orange box. |
63 | | - boxOrange = createBox(0, 0, 40, 40) |
| 61 | + page.boxOrange = createBox(0, 0, 40, 40) |
64 | 62 | that.color = "orange" |
65 | 63 | that.round = 40 |
66 | 64 | that.border = 6 |
67 | 65 | that.borderColor = "rgba(0, 0, 0, 0.2)" |
68 | | - that.aline(boxGray, "bottom", 20, "center") |
| 66 | + that.aline(page.boxGray, "bottom", 20, "center") |
69 | 67 |
|
70 | 68 | page.onResize(pageResized) |
71 | 69 |
|
|
74 | 72 | var pageResized = function() { |
75 | 73 |
|
76 | 74 | // Recalculate the position of the boxes. |
77 | | - boxGray.center() |
78 | | - boxRed.aline(boxGray, "right", 4) |
79 | | - boxOrange.aline(boxGray, "bottom", 20, "center") |
| 75 | + page.boxGray.center() |
| 76 | + page.boxRed.aline(boxGray, "right", 4) |
| 77 | + page.boxOrange.aline(boxGray, "bottom", 20, "center") |
80 | 78 |
|
81 | 79 | } |
82 | 80 | </div> |
|
0 commit comments