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
Fill in the blank to store the window's width in the variable. | var windowWidth = $(window)_______ | .width(); | ^ *\.width\(\); *$ |
Fill in the blank to store the window's height in the variable. | var windowHeight = $(window)________ | .height(); | ^ *.height\(\); *$ |
Fill in the blank to store the window's width in the variable. | var windowWidth = ________________ | $(window).width(); | ^ *\$\(window\)\.width\(\); *$ |
Fill in the blank to store the window's height in the variable. | var windowHeight = ________________ | $(window).height(); | ^ *\$\(window\)\.height\(\); *$ |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to make the div the same width as the window. | var windowWidth = $(window).width(); $("div.fit_to_window").css("width", windowWidth); | ||
Measure the window width and store it in the variable winW, which hasn't been declared. | var winW = $(window).width(); | var`1spacewinW`1space=`1space$`(`window`)`.`width`(`)`; | |
Measure the window height and store it in the variable winH, which hasn't been declared. | var winH = $(window).height(); | ||
Measure the window width and store it in a variable. Make up the name of the variable. | var winW = $(window).width(); | ^ *var .+ = \$\(window\)\.width\(\); *$ | |
Make a div fit the window width. Make up the name of the div's id and the variable name that stores the window width. | $("div#main").css("width", windowWidth); | ^ *\$\(•div#.+•\)\.css\(•width•, .+\); *$ | |
Make a div fit the window width in a single statement. (Specify the window width without using a variable.) Make up the div's id. | $("div#main").css("width", $(window).width()); | ^ *\$\(•div#.+•\)\.css\(•width•, \$\(window\)\.width\(\)\); *$ | |
The window height has been assigned to the variable winH. Make a div a percentage of the window width. Make up the div's id and the percentage. | $("div#main").css("height", winH * .75); | ^ *\$\(•div#.+•\)\.css\(•height•, winH \* \.[0-9]+\); *$ | |
The window width and height have been assigned to two variables. Make a div's width the same as the window width and the div's height 35 percent of the window's height. Make up the variable names and the div's id. | $("div#main").css("width", winW).css("height", winH * .35); | ^ *\$\(•div#.+•\)\.css\(•width•, .+\)\.css\(•height•, .+ \* \.35\); *$ | |
Measure the window height and store it in the variable winH, which hasn't been declared. | var winH = $(window).height(); | ^ *var winH = \$\(window\)\.height\(\); *$ | |
Measure the window width and store it in a variable. Make up the name of the variable. | var winW = $(window).width(); | ^ *var .+ = \$\(window\)\.width\(\); *$ | |
Make a div fit the window width. Make up the name of the div's id and the variable name that stores the window width. | $("div#main").css("width", windowWidth); | ^ *\$\(•div#.+•\)\.css\(•width•, .+\); *$ | |
Make a div fit the window width in a single statement. (Specify the window width without using a variable.) Make up the div's id. | $("div#main").css("width", $(window).width()); | ^ *\$\(•div#.+•\)\.css\(•width•, \$\(window\)\.width\(\)\); *$ | |
The window height has been assigned to the variable winH. Make a div a percentage of the window width. Make up the div's id and the percentage. | $("div#main").css("height", winH * .75); | ^ *\$\(•div#.+•\)\.css\(•height•, winH \* \.[0-9]+\); *$ | |
The window width and height have been assigned to two variables. Make a div's width the same as the window width and the div's height 35 percent of the window's height. Make up the variable names and the div's id. | $("div#main").css("width", winW).css("height", winH * .35); | ^ *\$\(•div#.+•\)\.css\(•width•, .+\)\.css\(•height•, .+ \* \.35\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/n559qwc7/ | |||
http://jsfiddle.net/ASmarterWayToLearn/90hh8zqk/ |