Use getBoundingClientRect()
to improve handling of menu placement when the body is scrolled or has margin settings. Resolves issue #1434 (closed).
Here bbox.right
gives the position of the right-hand side of the body, unless it is scrolled left, in which case the bbox.left
will be negative, so we add it in. These don't seem to take the left margin into account, so we add that in as well.