title: Show div at cursor and keep div within viewable area
body: <p>I got the div to load a page when hovering over the hyperlink attached to the photo, but if the photo is too close to the viewable screen area, the div will be cut off and you have to scroll to see it. How can I offset the div so the entire div is shown within the viewable area? Also, I was expecting the div to move along with the mouse as the mouse moved across the photo, that is not occurring.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var mouseX;
  var mouseY;
  $(document).mousemove( function(e) {
  mouseX = e.pageX; 
  mouseY = e.pageY;
  });  
  $(".ttip").mouseover(function(){
  $('#meminfotip').css({'top':mouseY,'left':mouseX}).show().load('blah.php?id='+this.id);
  });
  
  $('.ttip').mouseout(function(){
  $('#meminfotip').hide();
  });
  &lt;/script&gt;
  
  &lt;a class="ttip" id="1" href="blahh.php?id=1&gt;"&gt;&lt;img src="images/blah.jpg" /&gt;&lt;/a&gt;
  
  &lt;div id="meminfotip" style="display:none;z-index:999999;position:absolute;"&gt;&lt;/div&gt;
  </code></pre>