How do you check if an element is entirely visible?

How do you check if an element is entirely visible?

Hello everyone.

I've been searching around for an answer to this question for some time now. How do you check if an element is entirely visible (in other words: entirely in the viewport) ?

I have a page and when you hover over a certain link, it fades in a div with extra information. This div can be quite big sometimes, so I want to check if it is entirely in the viewport (the user can see the entire div). If it isn't, I want to be able to move it to the left somewhat.

But how do I check if the item is completely visible? I've been searching around in the (excellent) Jquery documentation, but couldn't find an answer. Can any of you point me in the right direction?

Thanks a lot.