source: other-projects/nz-flag-design/trunk/main-form/choose-canvas.html@ 29773

Last change on this file since 29773 was 29773, checked in by davidb, 9 years ago

Changes so i) the choose-palette is a single interactive SVG csurface; 2) the JS runs more smoothly when 'started' at one of the later pages; and 3) changes to remove many of the warnings browsers produce when loading the page

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1<!DOCTYPE html>
2<html id="story">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5 <meta name="viewport" content="width=device-width, initial-scale=1"/>
6 <title>Canvas Size</title>
7
8 </head>
9 <body>
10 <div data-role="page" id="choose-canvas-page"
11 class="demo-page"
12 data-dom-cache="true"
13 data-prev="index"
14 data-next="choose-palette">
15
16 <div data-role="content">
17
18 <div data-role="controlgroup" class="control" data-mini="true">
19 <a href="#" class="next right-button res-fwd" style="right:1%;"></a>
20 <a href="#" class="prev left-button gen-back" style="left:1%;"></a>
21 </div>
22
23 <div class="story-page">
24
25 <!-- put custom content here -->
26 <span class="left story-icon idea" ></span>
27 <h2>Canvas Size</h2>
28
29 <div class="dialog" id="dialog" title="Ratio Select Dialog" width="800px">
30 <br><br>
31 <h2>Please choose from the following aspect ratios.</h2>
32 <p>If you hover the mouse over a flag size, you will be able to see some countries that currently use that ratio!</p>
33 <div class="centredDiv">
34 <div class="ratioDiv flagHover" id="ratio23" onclick="updateCanvasDimensions(2, 3)" title="2:3"></div>
35 <div class="ratioDiv" style="border-width:2px;" id="ratio12" onclick="updateCanvasDimensions(1, 2)" title="1:2"></div>
36 <div class="ratioDiv" id="ratio35" onclick="updateCanvasDimensions(3, 5)" title="3:5"></div>
37 <div style="clear: both"></div>
38 </div>
39 <p class="optionline">2:3 1:2 3:5</p><br>
40
41 <div class="centredDiv">
42 <div class="ratioDiv" id="ratio1019" onclick="updateCanvasDimensions(10, 19)" title="10:19"></div>
43 <div class="ratioDiv" id="ratio58" onclick="updateCanvasDimensions(5, 8)" title="5:8"></div>
44 <div class="ratioDiv" id="ratio811" onclick="updateCanvasDimensions(8, 11)" title="8:11"></div>
45 <div style="clear: both"></div>
46 </div>
47 <p class="optionline">10:19 5:8 8:11</p>
48 </div>
49
50 <script>
51 // Variable for the currently selected flag ratio
52 var currentRatio = "ratio12";
53
54 function updateCanvasDimensions(height, width) {
55 // Show feedback by highlighting the chosen square
56 document.getElementById(currentRatio).style.borderColor = 'black';
57 document.getElementById(currentRatio).style.borderWidth = '1px';
58 currentRatio = "ratio" + height + width;
59 document.getElementById(currentRatio).style.borderColor = 'white';
60 document.getElementById(currentRatio).style.borderWidth = '2px';
61
62 // Changing the value of sizeConstant will change the
63 // size of the svg canvas without affecting the
64 // width/height ratios
65
66 var sizeConstant = 400;
67
68 var h = sizeConstant;
69 var w = (sizeConstant / height) * width;
70
71 if (typeof flagCanvasSettings !== 'undefined') {
72 flagCanvasSettings.width = w;
73 flagCanvasSettings.height = h;
74 }
75 }
76 </script>
77
78 <!-- end of putting custom content -->
79
80 </div> <!-- end story-page-->
81
82 </div><!-- /content -->
83
84 </div><!-- /page -->
85
86 </body>
87</html>
Note: See TracBrowser for help on using the repository browser.