Jquery event capture change in margin-left
<p>I have a situation in here I have a div that was margin: auto to get it to be centered.</p>

<p>That works fine, but when I resize the window I want it to stop centering when a certain margin-left is reached.</p>

<p>The ideia is that I have a floating object to the left, and I dont want it to be overlapped.</p>

<p>Anybody as a suggestion?</p>

<p>Thanks</p>

<p><strong>EDIT</strong>: Code Addded</p>

<pre><code>&lt;nav id="servicos_nav"&gt;
    &lt;div id="full"&gt;
        ...
    &lt;/div&gt;
    &lt;div id="minimized"&gt;
        ...
    &lt;/div&gt;
&lt;/nav&gt;
&lt;section id="content"&gt;
… PHP generated code …
&lt;/section&gt;
</code></pre>

<p>The nav is absoluted possitioned because it was some effects, changind minimized by full with animations.</p>

<p>Section content as width of 860px and margin auto. But there is and element in the nav that always as 140px width and I dont want that minimizing the window causes the content to overlap with that element. </p>

<p><strong>SolutionEdit</strong>: My solution based on the awnser (the static width was just easier :-) ):</p>

<pre><code>window.onresize = function(event) {
        if(window.innerWidth &lt;= 1142)
        {
            $("#content").css("margin-left","140px");
        }
        else
        {
            $("#content").removeAttr("style");
        }
    };
</code></pre>
