The next several exercises are timed. If you type slowly or dislike time pressure, feel free to increase the allotted time.
Name and email required. Check any number of boxes.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
0
0
0
To delay something from happening, wrap it in a _______ function. | callback | ^ *callback *$ | |
Fill in the blank to complete the line that begins a callback function. | $("img#house_big").toggleClass ("nowhere_element").css({ opacity: 0}).fadeTo(1500, 1, function___ | () { | ^ *\(\) { *$ |
Fill in the blank to complete the line that begins a callback function. | $("img#house_big"). toggleClass("nowhere_element") .css({opacity: 0}).fadeTo (1500, 1, _______ | function() { | ^ *function\(\) { *$ |
What are the three characters that close a callback function? | }); | ^ *}\); *$ | |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to code a callback function that wraps an alert. | function() { alert("Buy now!"); }); | ||
Code the first 12 characters of a callback function that follow the comma and space. | function() { | function`(`) `{ | |
Code the closing line of a callback function. | }); | ||
Fade an image to visibility in two seconds without a delay. Make up the id of the image. | $("img#house").fadeTo(2000, 1); | ^ *\$\(•img#.+•\)\.fadeTo\(2000, 1\); *$ | |
Fill in the blank to complete the line, delaying the fade. | $("img#house".fadeTo(3000, 1____________ | , function() { | ^ *, function\(\) { *$ |
Code the line that fades an image to visibility in three seconds and begins a callback function. Make up the id of the image. | $("img#house").fadeTo(3000, 1, function() { | ^ *\$\(•img#.+•\)\.fadeTo\(3000, 1, function\(\) { *$ | |
Code a line that fades a div to invisibility after a delay. Make up the id of the div and the speed of the fade. | $("div#products").fadeTo(1500, 0, function() { | ^ *\$\(•div#.+•\)\.fadeTo\([0-9]+, 0, function\(\) { *$ | |
Code three lines that fade an image to visibility, with an alert that displays after the fade. Make up the id of the image, the speed of the fade, and the alert's message. | $("img#house").fadeTo(1500, 1, function() { alert("Buy it!"); }); | ^ *\$\(•img#.+•\)\.fadeTo\([0-9]+, 1, function\(\) {\n *alert\(•.+•\);\n *}\); *$ | |
Code the closing line of a callback function. | }); | ^ *}\); *$ | |
Fade an image to visibility in two seconds without a delay. Make up the id of the image. | $("img#house").fadeTo(2000, 1); | ^ *\$\(•img#.+•\)\.fadeTo\(2000, 1\); *$ | |
Fill in the blank to complete the line, delaying the fade. | $("img#house".fadeTo(3000, 1____________ | , function() { | ^ *, function\(\) { *$ |
Code the line that fades an image to visibility in three seconds and begins a callback function. Make up the id of the image. | $("img#house").fadeTo(3000, 1, function() { | ^ *\$\(•img#.+•\)\.fadeTo\(3000, 1, function\(\) { *$ | |
Code a line that fades a div to invisibility after a delay. Make up the id of the div and the speed of the fade. | $("div#products").fadeTo(1500, 0, function() { | ^ *\$\(•div#.+•\)\.fadeTo\([0-9]+, 0, function\(\) { *$ | |
Code three lines that fade an image to visibility, with an alert that displays after the fade. Make up the id of the image, the speed of the fade, and the alert's message. | $("img#house").fadeTo(1500, 1, function() { alert("Buy it!"); }); | ^ *\$\(•img#.+•\)\.fadeTo\([0-9]+, 1, function\(\) {\n *alert\(•.+•\);\n *}\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/j78atz4t/ | |||
http://jsfiddle.net/ASmarterWayToLearn/xapg9r2t/ |