Width giving a different result while/after loading the page
<p>I am trying to set the margin-left of a specific div (let's call it: div1) to be:</p>

<pre><code>-1 * $('.div2 canvas').width()/2
</code></pre>

<p>So I am using the following line of code to do that:</p>

<pre><code>$('#div1').css('margin-left', -1 * $('.div2 canvas').width()/2);
</code></pre>

<p>Once the page is loaded the result it gives me is -150. However, if I run the same exact line of code in the Chrome console, it gives the right result: -360 since the total width of div2 is 720.</p>

<p>I tried adding:</p>

<pre><code>$(window).load(function () { });
</code></pre>

<p>or</p>

<pre><code>$('#div1').load(function () { });
</code></pre>

<p>or</p>

<pre><code>$('.div2 canvas').load(function () { });
</code></pre>

<p>but that did not help.</p>

<p>My assumption is that the width of div2 is changing based on some sort of information that is being injected and that once the page is ready the total width of the div 720px (in this example) but I am not entirely sure how to run this line of code once the whole page has been loaded and everything has been injected.</p>
