Fortunately for you, I had to develop almost what you want. It's a jQuery extension that tells you how visible an element is relative to the browser window. It returns an object with two properties, horizontal and vertical. If vertical value is -1, then the element is invisible and over the viewport. If it is 0, then it's visible. If the result if 1, then invisible but under the viewport. Similarly for horizontal.
The difference is that '0' doesn't differentiate between 'completely in the viewport' or partially in the viewport. I needed it to determinate if something was above, in, or below the viewport (and the same for left and right). However, it's a good point to start and it can easily be changed to what you need.
jQuery.fn.viewportPosition = function () {
var $window = $(window);
var position = this.offset();
var viewport = { bottom: $window.height(), right: $window.width() };
var rect = { top: position.top, left: position.left, bottom: position.top + this.height(), right: position.left + this.width() };
return {
vertical: (rect.bottom < 0) ? -1 : (rect.top > viewport.bottom) ? 1 : 0,
horizontal: (rect.left < 0) ? -1 : (rect.left > viewport.right) ? 1 : 0
};
};