(^488) ❘ APPENDIX A EXERCISE ANSWERS
bapp01.indd 02/18/2015 Page 488
$('#myScroller').scrollTop(0);
- Answers will vary but should describe calculating the element’s scrollHeight and using an
arbitrary value expected to be larger than the scrollHeight.
CHAPTER 11
- Depending on the browser, you use the –webkit-user-drag CSS property with a value of ele-
ment for older versions of Webkit-based browsers such as Safari and Chrome. You use the
draggable HTML attribute, which is the offi cial method sanctioned by the HTML5 specifi ca-
tion and supported by all modern browsers. Or you can use the dragDrop() method on the
element’s DOM object, which enables drag and drop in IE5 through IE8. - The drag events in the order that they fi re are dragstart, drag, and dragend.
- The drop events in the order that they fi re are dragenter, dragover, drop, and dragleave.
- You look for event.originalEvent.dataTransfer.files within the drop event. Without using
jQuery to attach the event listener, you look for event.dataTransfer.files within the drop
event. - A base64-encoded data URI is assigned to the value of the src attribute of an
element. The data URI can also be used with the CSS background and background-image
properties. - The progress and load events can be attached to the upload property of an XMLHttpRequest
object to monitor the upload progress of fi les. - The event.lengthComputable, event.loaded, and event.total properties.
- First, you instantiate the FormData object; the instantiated object is stored in a variable. Then
use the append() method on the instantiated object to create custom POST variables. - You attach a load event to the XMLHttpRequest object. This event is fi red when the upload is
successful.
CHAPTER 12
- draggable()
- Any syntactically correct program, which implements the following (or similar enough to the
following):
draggable({
helper : 'clone',
opacity : 0.5
});