Scrolling to an element in a non-window container: correct method for calculating the target position

Scroll an item to the top by clicking on it.

Select a method for calculating the target position:

Item #1 Item #2 Item #3

For a function which works for both window and non-window scroll containers, see this gist.