Why this js script does not work in asp.net after postback?
<p>I have this code:</p>

<pre><code> if (Page.IsPostBack)
    {
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Javascript", "alert('test');jQuery('html, body').animate({ scrollTop: jQuery('.newslettersubscribe').position().top }, 'slow');",true);
    }
</code></pre>

<p>I don't understand why the scrolling to the div which is on the bottom of the page, does not work.</p>

<p>Please note that <code>alert('test')</code> is appearing...</p>

<p>For sure I have a div with class <code>newslettersubscribe</code> on my page.</p>

<p><strong>UPDATE</strong>:
- my js files are loaded using Script Manager:</p>

<pre><code>&lt;asp:ScriptManager ID="ScriptManager1" runat="server" &gt;
    &lt;Scripts&gt;
        &lt;asp:ScriptReference Path="~/js/jquery-1.4.2.min.js" /&gt;
        &lt;asp:ScriptReference Path="~/js/cufon-yui.js" /&gt;
        &lt;asp:ScriptReference Path="~/js/helvetica_neue.js" /&gt;
        &lt;asp:ScriptReference Path="~/js/jquery.cycle.all.js" /&gt;
        &lt;asp:ScriptReference Path="~/js/default.js" /&gt;
        &lt;asp:ScriptReference Path="~/js/swfobject-2.1.js" /&gt;
    &lt;/Scripts&gt;
&lt;/asp:ScriptManager&gt;
</code></pre>

<p>so I need to find a way to run this inline script AFTER these external js files were loaded...</p>

<p><strong>UPDATE 2:</strong> After a chat discussion with dknaack we noticed that there was also an issue with <code>position</code>. I've replaced with <code>offset</code> at his recommandation and now it's working!!!</p>

<p>Thanks a lot <strong>dknaack</strong> !</p>
