title: JavaScript zoom image and center viewable area
body: <p>I'm trying to create a zoom able image upon click of a button, however the image should be zoomed centered on the view able area, as the image may be bigger than the container.</p>
  
  <p>I've created a fiddle here to illustrate what I want, I'd obviously usually hide the image outside the container, I'm not bothered about that part just now, also put in a border overlay to show the bounds of the container.</p>
  
  <p>I've done the zoom part based on the image ratio, I just need to work out the new top and left css values and apply it to the image after the zoom.  Also the image is draggable, so once you move the image it must take into account the position of the image.</p>
  
  <p>Basically, the centrol point of the image within the red container must remain the same after the zoom, so you are effectly zooming in on whatever is at the middle of the container.</p>
  
  <p><a href="http://jsfiddle.net/wFaFg/1/" rel="nofollow">http://jsfiddle.net/wFaFg/1/</a></p>
  
  <pre><code>why do you we need code to link to jsfiddle?
  </code></pre>
  
  <p>Thanks</p>
  
  <p>edit:</p>
  
  <p><a href="http://jsfiddle.net/FU55w/" rel="nofollow">http://jsfiddle.net/FU55w/</a></p>
  
  <p>getting close with the above fiddle, but still not zooming completely on central point</p>