Gravity is a JavaScript jQuery function for working out the best possible location for an element to attach to another element.