Subversion Repositories jquery

[/] [plugins/] [examples/] [jeopardy/] [jeopardy.html] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 -
2
  <head>
3
    <title>Algebra Jeopardy</title>
4
    <meta content="">
5
<!--
6
**************************************************
7
*           Algebra Jeopardy
8
**************************************************
9
 
10
For: 4th Grade student teaching - Test preparation
11
 
12
Questions and Answers by: Lisa Emerald-Kaufman
13
Code by: Dan VerWeire ([email protected])
14
 
15
**************************************************
16
-->
17
18
body {
19
        padding : 0px;
20
        margin : 0px;
21
}
22
 
23
div.header {
24
        padding-top: 1%;
25
        font-family : arial;
26
        text-align : center;
27
        font-size : 25pt;
28
        font-weight : bold;
29
        background-color : #132764;
30
        border-color : 2px black solid;
31
        color : white;
32
        height : 8%;
33
}
34
 
35
 
36
 
37
body table {
38
        width : 100%;
39
        height : 90%;
40
}
41
 
42
body table td {
43
        cursor : pointer;
44
        vertical-align : center;
45
        text-align : center;
46
        font-size : 50pt;
47
        font-family : arial;
48
        border : 3px #031754 outset;
49
        width : 20%;
50
        color : orange;
51
        background-color : #031754;
52
 
53
}
54
 
55
body table td div div {
56
        vertical-align : center;
57
        padding : 10%;
58
}
59
 
60
tr.header td {
61
        height : 45pt;
62
        cursor : default;
63
        color : white;
64
        font-size : 30pt;
65
        border : 3px #000744 outset;
66
        background-color : #000744;
67
}
68
 
69
 
70
71
        <script src="jquery-1.3.2.min.js"></script>
72
        <script>
73
$(function () {
74
        var container = 'body';
75
        var useAnimation = true;
76
 
77
        var inOutTableVirtical =
78
                '<table width="100" border="1" style="width:100px" align="center"> ' +
79
                '       <tr><th>IN</th><th>OUT</th></tr> ' +
80
                '       <tr><td>6</td><td>3</td></tr> ' +
81
                '       <tr><td>8</td><td>5</td></tr> ' +
82
                '       <tr><td>13</td><td>10</td></tr> ' +
83
                '       <tr><td>N</td><td></td></tr> ' +
84
                '</table> ';
85
 
86
        var boardContents = {
87
                'Vocabulary' : {
88
                        '100' : {
89
                                question : 'What is a sequence that repeats and tells us what to expect next?',
90
                                answer : 'A pattern'
91
                        },
92
                        '200' : {
93
                                question : 'What is a symbol or letter that stands for a number?',
94
                                answer : 'A variable'
95
                        },
96
                        '300' : {
97
                                question : 'What is a number sentence that uses the equal sign to show that two expressions have the same value?',
98
                                answer : 'An equation'
99
                        },
100
                        '400' : {
101
                                question : 'What is the term to describe one way of representing what we know in a word problem which contains numbers and at least one operation?',
102
                                answer : 'A number expression'
103
                        },
104
                        '500' : {
105
                                question : 'What is an expression with a variable which contains at least one operation?',
106
                                answer : 'An algebraic expression'
107
                        }
108
                },
109
                'Expressions' : {
110
                        '100' : {
111
                                question : 'Evaluate the expression for W = 2. <br /><br /> W + 4',
112
                                answer : '6'
113
                        },
114
                        '200' : {
115
                                question : 'Evaluate the expression for W = 5. <br /><br /> 10 - W',
116
                                answer : '5'
117
                        },
118
                        '300' : {
119
                                question : 'What is the number expression for the phrase "$12 increased by $4" ?',
120
                                answer : '$12 + $4'
121
                        },
122
                        '400' : {
123
                                question : 'What is the number sentence for the phrase "twice the number of 7 cars" ?',
124
                                answer : '2 x 7 = 14 cars'
125
                        },
126
                        '500' : {
127
                                question : 'What is the number sentence for the phrase "15 less than 30 days" ?',
128
                                answer : '30 - 15 = 15 days'
129
                        }
130
                },
131
                'Equations' : {
132
                        '100' : {
133
                                question : '<br /><br />M + 200 = 400<br />',
134
                                answer : '<br /><br />M = 200'
135
                        },
136
                        '200' : {
137
                                question : '<br /><br />26 - R = 20<br />',
138
                                answer : '<br /><br />R = 6'
139
                        },
140
                        '300' : {
141
                                question : '<br /><br />Z - 13 = 7<br />',
142
                                answer : '<br /><br />Z = 20'
143
                        },
144
                        '400' : {
145
                                question : '<br /><br />11 x 8 = P<br />',
146
                                answer : '<br /><br />P = 88'
147
                        },
148
                        '500' : {
149
                                question : '<br /><br />35 <img src="divide.png" style="vertical-align:middle"/> N = 5',
150
                                answer : '<br /><br />N = 7'
151
                        }
152
                },
153
                'What is the Rule?' : {
154
                        '100' : {
155
                                question : 'When a function machine has an input of 10 and a rule of +4, what is the output?',
156
                                answer : '14'
157
                        },
158
                        '200' : {
159
                                question : 'When a function machine has an input of 5 and an output of 15, what is the rule?',
160
                                answer : 'Add 10'
161
                        },
162
                        '300' : {
163
                                question :
164
                                        '<table width="100" border="1" style="width:100px;margin-bottom:-50pt" align="center" >' +
165
                                        '       <tr class="header"><td class="header">IN</td><td class="header">OUT</td></tr> ' +
166
                                        '       <tr><td>6</td><td>3</td></tr> ' +
167
                                        '       <tr><td>8</td><td>5</td></tr> ' +
168
                                        '       <tr><td>13</td><td>10</td></tr> ' +
169
                                        '       <tr><td>N</td><td>&nbsp;</td></tr> ' +
170
                                        '</table>',
171
                                answer : 'N - 3. Rule = subtract three'
172
                        },
173
                        '400' : {
174
                                question :
175
                                        '<table width="100" border="1" style="width:100px;margin-bottom:-50pt" align="center" >' +
176
                                        '       <tr class="header"><td class="header">IN</td><td class="header">OUT</td></tr> ' +
177
                                        '       <tr><td>9</td><td>3</td></tr> ' +
178
                                        '       <tr><td>21</td><td>7</td></tr> ' +
179
                                        '       <tr><td>18</td><td>6</td></tr> ' +
180
                                        '       <tr><td>G</td><td>&nbsp;</td></tr> ' +
181
                                        '</table>',
182
                                answer : 'G <img src="divide.png" style="vertical-align:middle"/> 3. Rule = divide by three'
183
                        },
184
                        '500' : {
185
                                question :
186
                                        '<table border="1" style="height : 100px; width: auto; margin-bottom:-50pt" align="center" >' +
187
                                        '       <tr><td class="header">IN</td><td>5</td><td>1</td><td>10</td><td>L</td></tr> ' +
188
                                        '       <tr><td class="header">OUT</td><td>25</td><td>5</td><td>50</td><td>&nbsp;</td></tr> ' +
189
                                        '</table>',
190
                                answer : 'L x 5. Rule = multiply by five'
191
                        }
192
                },
193
                'Miscellaneous' : {
194
                        '100' : {
195
                                question : '<br /><br />X+X+X+X+, X+X+X+, X+X+, _________ <br />',
196
                                answer : '<br /><br /><u>X+</u>. Rule = minus one X and minus one +'
197
                        },
198
                        '200' : {
199
                                question : '<br /><br />A, C, E, G, I, K, __, __ <br />',
200
                                answer : '<br /><br /><u>M</u>, <u>O</u>. Rule = skip a letter'
201
                        },
202
                        '300' : {
203
                                question : '<br /><br />11:15, 11:25, 11:35, ____, ____ <br />',
204
                                answer : '<br /><br /><u>11:45</u>, <u>11:55</u>. Rule = add ten minutes'
205
                        },
206
                        '400' : {
207
                                question : 'How is a number sentence different from a number expression?',
208
                                answer : 'A number sentence has an equal sign and an answer. An example of a number sentence is 2 + 2 = 4. An example of a number expression is 2 + 2.'
209
                        },
210
                        '500' : {
211
                                question : 'Name two of the three methods you may use to solve an equation or to find a rule.',
212
                                answer : 'Mental math, inverse operations, guess and check'
213
                        }
214
                }
215
        }
216
 
217
 
218
        var $header = $('<div />').addClass('header').append("Algebra Jeopardy");
219
        var $board = $('<table cellpadding="0" cellspacing="0" />');
220
 
221
        var $rows = [];
222
        $rows[$rows.length] = $('<tr />').addClass('header').appendTo($board);
223
 
224
        $.each(boardContents, function (categoryName) {
225
                var rowIndex = 0;
226
                var category = this;
227
 
228
                var $td = $('<td />')
229
                        .html(categoryName)
230
                        .appendTo($rows[rowIndex]);
231
 
232
                rowIndex++;
233
 
234
                $.each(category, function (amt) {
235
                        var thisCategory = this;
236
 
237
                        if (!$rows[rowIndex]) {
238
                                var $row = $('<tr />').appendTo($board);
239
                                $rows[$rows.length] = $row;
240
                        }
241
                        else {
242
                                var $row = $rows[rowIndex];
243
                        }
244
 
245
 
246
                        var contentMode = 'question';
247
                        var $fullPage = null;
248
                        var $fullPageContent = null;
249
 
250
                        var $td = $('<td />')
251
                                .appendTo($row)
252
                                .click(function () {
253
                                        var value;
254
 
255
                                        switch (contentMode) {
256
                                                case 'amt' :
257
                                                        value = amt;
258
                                                        contentMode = 'question';
259
                                                        $content.html(value);
260
                                                        break;
261
                                                case 'done' :
262
                                                        value = '-';
263
                                                        contentMode = 'amt';
264
                                                        $content.html(value);
265
                                                        $fullPage && $fullPage.remove();
266
 
267
                                                        break;
268
                                                case 'question' :
269
                                                        value = thisCategory.question
270
                                                        contentMode = 'answer';
271
 
272
 
273
                                                        if (useAnimation) {
274
                                                                $fullPage = $('<div />').appendTo(document.body)
275
                                                                        .css({
276
                                                                                left : $td.offset().left + ($td.width() / 2),
277
                                                                                top : $td.offset().top + ($td.height() / 2),
278
                                                                                width : '0px',
279
                                                                                height : '0px',
280
 
281
                                                                                color : 'white',
282
                                                                                fontSize : '35pt',
283
                                                                                backgroundColor : '#031754',
284
                                                                                border : '#031754 10px outset',
285
 
286
                                                                                //display : 'table-cell',
287
                                                                                verticalAlign : 'middle',
288
                                                                                position : 'absolute'
289
 
290
                                                                        })
291
                                                                        .animate ({
292
                                                                                top : '0px',
293
                                                                                left : '0px',
294
                                                                                width : '90%',
295
                                                                                height : '90%',
296
                                                                                marginRight : '5%',
297
                                                                                marginLeft : '5%',
298
                                                                                marginTop: '2%'
299
                                                                        }, 'slow', function () {
300
                                                                                $fullPageContent
301
                                                                                        .html('Question: ' + value + '<br /><br />');
302
                                                                        })
303
                                                                        .click(function () {
304
                                                                                $td.trigger('click');
305
                                                                        })
306
 
307
                                                        }
308
                                                        else {
309
                                                                $fullPage = $('<div />').appendTo($td)
310
                                                                        .css({
311
                                                                                top : '0px',
312
                                                                                left : '0px',
313
                                                                                width : '90%',
314
                                                                                height : '90%',
315
                                                                                marginRight : '5%',
316
                                                                                marginLeft : '5%',
317
                                                                                marginTop: '2%',
318
 
319
                                                                                color : 'white',
320
                                                                                fontSize : '35pt',
321
                                                                                backgroundColor : '#031754',
322
                                                                                border : '#031754 10px outset',
323
 
324
                                                                                verticalAlign : 'middle',
325
                                                                                position : 'absolute'
326
 
327
                                                                        })
328
                                                                        .html('Question: ' + value + '<br /><br />');
329
                                                        }
330
 
331
                                                        $fullPageContent = $('<div />')
332
                                                                .appendTo($fullPage);
333
 
334
                                                        break;
335
                                                case 'answer' :
336
                                                        value = thisCategory.answer;
337
                                                        contentMode = 'done';
338
 
339
                                                        $fullPageContent && $fullPageContent.append('Answer: ' + value + '<br /><br />');
340
 
341
                                                        break;
342
                                        }
343
 
344
 
345
                                                /*$($content).fadeOut(function () {
346
                                                        $content = $('<div />')
347
                                                                .html(value)
348
                                                                .css({display : 'none'})
349
                                                                .appendTo($td)
350
                                                                .fadeIn();
351
                                                });*/
352
 
353
 
354
                                })
355
 
356
 
357
                        var $content = $('<div />')
358
                                .append(amt)
359
                                .appendTo($td);
360
 
361
                        rowIndex++;
362
                });
363
        });
364
 
365
 
366
 
367
        $('body').append($header).append($board);
368
});
369
        </script>
370
  </head>
371
  <body></body>
372
</html>