Hi there, I'm dynamically pulling my sidebar image from a database, the image is resized to fit based on which dimension is smaller. Then I'm using a jquery script to reposition the image so that any overflow on the width overflows both sides rather than just on the right using this script:
<script type="text/javascript">
$(document).ready(function()
{
$("#sidebar-image>img").each(function(i, img) {
$(img).css({
position: "relative",
left: ($(img).parent().width() - $(img).width()) / 2
});
});
});
</script>
The problem I'm having is that sometimes the width isn't getting calculated properly, it doesn't seem to get the width of the image everytime and I'm assuming that maybe the jquery is firing before the image is pulled from the database? If I refresh the page the image positions properly.