Fixed scroll issue when scrolling down to elements bigger than window

When scrolling down to element that are bigger than the screen, it will scroll down to the bottom of that element. That leads to that you don't see the tooltip. This PR solves that issue by checking the size of the element and compares it with the window.