jQuery How to check of element exceed browser window size and reposition it
<p>I have this code:</p>

<pre><code>var pos = $(this).offset();
        var width = $(this).width();
        userPreviewCon.css({
            left: (pos.left + 30) + 'px',
            top: pos.top + 15 + 'px'
        }).fadeIn();
</code></pre>

<p>And this is for position popup window relative to element, that mouse is pointing.
But when element is close to window border, it show up and some of it is invisible, because part of tooltip exceed window size.
The question is how to reposition  tooltip to no longer exceed window border ?</p>
