Simplifying offset condition. Always use getBoundingClientRect solution.