Add new side anchor options for $.fn.positionToSide().
Review Request #9022 — Created June 18, 2017 and submitted
This enhances
$.fn.positionToSide()
to accept new side codes:T
,
B
,L
, andR
. These are similar to the original codes, but rather
than positioning such that the element is fully outside the anchor
element (with distances extending the element outward), these codes
position so that the positions are anchored within the element (with
distances extending the element further inward). This allows for easily
positioning (for instance) the left edge of an element 20 pixels to the
right of the left edge of another, or the bottom of an element 20 pixels
above the bottom of another.Along with this, distances can now be set per-side, instead of only
allowing for setting X/Y distances.These changes together allow for a lot more control over where elements
will appear in relation to other elements.Docs have been updated to document all the options and defaults.
I've also fixed some redundant jQuery wrapping and a bug preventing this
from being used in multiple elements at once.
Verified this works with our existing calls, and tested all the new options.