I have a script that resize a text .div (.block-left), to make room for a large picture. The picture width and height are determined by the user window. Depending on this parameters the text .div adapts itself.
To make do, the script runs twice, when the window is ready and when resized.
On most browsers the script works properly when the window is ready, but they are some hiccups on refresh, especially with Safari. The resize script, however, never encounters any bugs.
Here is the script (the same is used when on window resize) :
<script>
$(document).ready(function() {
var imgWidth = ($(".picture img").width()+ 20 + "px");
$(".block-left").css("margin-left", imgWidth);
});
</script>
You can see what it is supposed to accomplish on this screenshot :
What can I do to force the script to load first thing?