title: Position Around a Point
body: <p>I have a central point on the page (x,y) and need to evenly distribute a varying number of items (div's) around that point in a circle.  The distance from the central point will be fixed.</p>
  
  <p>This is my code thus far:</p>
  
  <pre><code>var noElements = $('div').size();
  var xDistance = 100;
  var angle = 0;
  var offset = 250;
  
  $('div').each(function(index) {
      angle = (360 / noElements)*index;
  
      $(this).css({'left': offset + (Math.sin(angle) * xDistance), 'top': offset + (Math.cos(angle) * xDistance)});
  });​
  </code></pre>
  
  <p>This is code in a <a href="http://jsfiddle.net/aUbAY/2/" rel="nofollow">fiddle</a>.</p>
  
  <p>It's not quite working, if you add more div's in the fiddle you will see occasionally the div's are not evenly distributed. For example having 8 elements, causes two at the bottom to overlap. </p>