I am trying to make the same user interface to preview image like on facebook.
I have one separate view that I display in fancybox.
It must be that I have made same error with max/min width/height. Basically as I see comment div should be 340px width always. And image div is resizable based on image size. In images bellow I use wider image to better show problem.
I load it like this:
$(document).ready(function () {
$('.fancybox').fancybox({
'autoSize': true,
'autoDimensions': true,
'transitionIn': 'fade',
'transitionOut': 'fade',
'hideOnOverlayClick': false,
'hideOnContentClick': false,
'closeBtn': false,
'type': 'ajax',
'padding': 0,
'margin': 0,
'minWidth': 500,
'fitToView': true
});
});
It load view fine.
That inner view code is:
<div style="height: 610px; width: 1100px;">
<div style="float: left; max-width: 510px;">
<img style="max-height: 100%;" src="http://a4.sphotos.ak.fbcdn.net/hphotos-ak-ash4/393726_2631619232954_1329592446_32973068_1109612286_n.jpg" />
</div>
<div style="float: right; width: 340px; height: 100%; background: #ff0000;">
<h3>
Description</h3>
</div>
</div>
This is what I get now:

And this is what I am trying to get:

UPDATE
Issue with smaller image based on @S.Visser answer.

In this example I use a table hack to center the image. The max width and height are there to make sure the image dont size to big.
html
css
Output:
