I dynamically add an image on my page :
<div class="simple_overlay" id="overlay">
<img src="" />
</div>
<script type="text/javascript">
$(function() {
$("a[rel]").overlay({
var source = this.getTrigger().attr('href');
this.getOverlay().find("img").attr({'src': source});
});
});
</script>
Now, I need to get width of the new image and calculate margin-left
corresponding to it. Native jQuery Tools methods doesn't work, because when overlay is loading, image hasn't yet loaded and container #overlay
width is 0.
Is there any option to emulate callback on this chain, so i can use width()
right after attr()
has evaluated?