title: Prevent overlap of randomly placed elements
body: <pre><code>        $(this).css({
              position: 'absolute',
              left: Math.random() * ($('.parentcontainer').width() - $(this).width()),
              top: Math.random() * ($('.parentcontainer').height() - $(this).height())
          });
  </code></pre>
  
  <p>I got this each loop that will randomly place elements within a div. The problem with this is that the elements will overlap each other sometimes because they are absolute positioned. Is there anyway to go around this in js to check position? or maybe rewrite this with margin values? Thanks a ton!</p>