will someone explain to me why my dialog only centers part of the time? Sometimes the first time the dialog loads the image it's off to the right, but if you click it a second time, it's centered. And sometimes the image will be centered and I refresh the page and it's off center???
I have the following markup...
<div class="details">
<img id="photo1" class="photos opacity" src="images/photos/angledBuilding_sm.jpg" alt="photography" />
</div>
and the following .js...
$('.photos').click( function() {
var id = this.id;
var src = this.src;
var lrg = "_lg";
var sm = "_sm"
var title = 'This title';//create a separate function to set the title of the image.
var srcNew = src.replace(sm, lrg);
var $dialogImg = '<div><img src=' + srcNew + ' /></div>'
var $dialog = $($dialogImg)
.html($dialogImg)
.dialog({
autoOpen: true,
modal: true,
title: ' ' + title + ' ',
width: 'auto',
height: 'auto',
resizable: false,
draggable: false,
});
$dialog.dialog('open');
$(id).dialog('option', 'position', 'top center');
});
You can see this at http://jameswadeweaver.com/portfolio.php
The Photography section at the bottom of the page is where I'm running into centering issues.