This version is old school.
Please find jQuery plugins on npm.
jQuery.iAmIn plugin
Plugin that will set your element on a side of its parent within container (if it can) or at start of the container (if can't).
Plugin that will set your element on a side of its parent within container (if it can) or at start of the container (if can't).