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 measure the width of the div. | $("div#main")______ | .width(); | ^ *\.width\(\); *$ |
Fill in the blank to measure the height of the image | $("img#loris")_______ | .height(); | ^ *\.height\(\); *$ |
Measure the width of a div and store it in the variable dWidth. Make up the id of the div. | var dWidth = $("div#prod").width(); | ^ *var dWidth = \$\(•div#.+•\)\.width\(\); *$ | |
Measure the height of a div and store it in the variable dHeight. Make up the id of the div. | var dHeight = $("div#main").height(); | ^ *var dHeight = \$\(•div#.+•\)\.height\(\); *$ | |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to measure the width of the window, then measure the width of a div and calculate its offset for centering horizontally. | var windowWidth = $(window).width(); var divWidth = $("div#daily").width(); var horizOffset = ((windowWidth - divWidth) / 2) + "px"; | ||
Measure the width of $(this) and store it in the variable wThis. | var wThis = $(this).width(); | var`1spacewThis`1space=`1space$`(`this`)`.`width`(`)`; | |
The selector for a div has been assigned to the variable elToMeasure. Measure its height and store it in the variable elHeight. | var elHeight = elToMeasure.height(); | ||
To measure the dimensions of a background image, measure its ____. | div | ^ *div *$ | |
Measure the width of a div and assign it to a variable. Make up the id of the div and the variable name. Calculate the div's offset for centering horizontally. In addition to the variable you created, you'll need the variable in the code below. | var winWidth = $(window).width(); | var divWidth = $("div#daily").width(); var offset = ((winWidth - divWidth) / 2) + "px"; | ^ *var (.+) = \$\(•div#.+•\)\.width\(\);\n *var .+ = \(\(winWidth - \1\) \/ 2\) \+ •px•; *$ |
Measure the width and height of $(this) and assign them to two variables. Make up the variable names. | var tWidth = $(this).width(); var tHeight = $(this).height(); | ^ *var .+ = \$\(this\)\.width\(\);\n *var .+ = \$\(this\)\.height\(\); *$ | |
Measure the width and height of a div and assign them to variables. Make up the id of the div and the two variable names. | var dWidth = $("div#main").width(); var dHeight = $("div#main").height(); | ^ *var .+ = \$\(•div#(.+)•\)\.width\(\);\n *var .+ = \$\(•div#\1•\)\.height\(\); *$ | |
Measure the height of a div and assign it to a variable. Using this variable plus the variable in the code below, calculate the div's offset for centering vertically and assign it to a variable. Fly it to that point. Make up the div id and two varaible names. | var winHeight = $(window).height(); | var dHeight = $("div#daily").height(); var vOffset = ((winHeight - dHeight) / 2) + "px"; $("div#daily").animate({top: vOffset}); | ^ *var (.+) = \$\(•div#(.+)•\)\.height\(\);\n *var (.+) = \(\(winHeight - \1\) \/ 2\) \+ •px•;\n *\$\(•div#\2•\)\.animate\({top: \3}\); *$ |
The selector for a div has been assigned to the variable elToMeasure. Measure its height and store it in the variable elHeight. | var elHeight = elToMeasure.height(); | ^ *var elHeight = elToMeasure\.height\(\); *$ | |
To measure the dimensions of a background image, measure its ____. | div | ^ *div *$ | |
Measure the width of a div and assign it to a variable. Make up the id of the div and the variable name. Calculate the div's offset for centering horizontally. In addition to the variable you created, you'll need the variable in the code below. | var winWidth = $(window).width(); | var divWidth = $("div#daily").width(); var offset = ((winWidth - divWidth) / 2) + "px"; | ^ *var (.+) = \$\(•div#.+•\)\.width\(\);\n *var .+ = \(\(winWidth - \1\) \/ 2\) \+ •px•; *$ |
Measure the width and height of $(this) and assign them to two variables. Make up the variable names. | var tWidth = $(this).width(); var tHeight = $(this).height(); | ^ *var .+ = \$\(this\)\.width\(\);\n *var .+ = \$\(this\)\.height\(\); *$ | |
Measure the width and height of a div and assign them to variables. Make up the id of the div and the two variable names. | var dWidth = $("div#main").width(); var dHeight = $("div#main").height(); | ^ *var .+ = \$\(•div#(.+)•\)\.width\(\);\n *var .+ = \$\(•div#\1•\)\.height\(\); *$ | |
Measure the height of a div and assign it to a variable. Using this variable plus the variable in the code below, calculate the div's offset for centering vertically and assign it to a variable. Fly it to that point. Make up the div id and two varaible names. | var winHeight = $(window).height(); | var dHeight = $("div#daily").height(); var vOffset = ((winHeight - dHeight) / 2) + "px"; $("div#daily").animate({top: vOffset}); | ^ *var (.+) = \$\(•div#(.+)•\)\.height\(\);\n *var (.+) = \(\(winHeight - \1\) \/ 2\) \+ •px•;\n *\$\(•div#\2•\)\.animate\({top: \3}\); *$ |
http://jsfiddle.net/ASmarterWayToLearn/n5kLct1h/ | |||
http://jsfiddle.net/ASmarterWayToLearn/0ok4wuno/ |