JQuery scrollTo next/prev div
<p>Any ideas why this code (which uses the scrollTo plugin) only works with jquery-1.4.2.min.js and how can I change it so that it works with the latest version of JQuery?</p>

<p><a href="http://webdesignerwall.com/tutorials/scrollto-posts-with-jquery" rel="nofollow">http://webdesignerwall.com/tutorials/scrollto-posts-with-jquery</a></p>

<p>Thanks :)</p>

<pre><code>&lt;script type="text/javascript" src="js/jquery-1.4.2.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/jquery.scrollTo-min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(function() {

function scroll(direction) {

    var scroll, i,
            positions = [],
            here = $(window).scrollTop(),
            collection = $('.post');

    collection.each(function() {
        positions.push(parseInt($(this).offset()['top'],10));
    });

    for(i = 0; i &lt; positions.length; i++) {
        if (direction == 'next' &amp;&amp; positions[i] &gt; here) { scroll = collection.get(i); break; }
        if (direction == 'prev' &amp;&amp; i &gt; 0 &amp;&amp; positions[i] &gt;= here) { scroll = collection.get(i-1); break; }
    }

    if (scroll) {
        $.scrollTo(scroll, {
            duration: 750       
        });
    }

    return false;
}

$("#next,#prev").click(function() {        
    return scroll($(this).attr('id'));        
});

$(".scrolltoanchor").click(function() {
    $.scrollTo($($(this).attr("href")), {
        duration: 750
    });
    return false;
});

});
&lt;/script&gt;
</code></pre>

<p>EDIT: </p>

<p>Just wanted to make my intent slightly clearer after feedback..</p>

<p>I want to use the latest version of JQuery 1.8.3, not 1.4.2. But when I use 1.8.3 the scrollTo #next or #prev  with class="post" on click doesn't appear to work. When I use 1.4.2 it does. I would be open to suggestions for completely new code however I must have tried at least 20 today and none have worked. At least this works... With an old version of JQuery... Which isn't compatible with my newer plugins :( I'm a real novice.</p>

<p>Basically, when the user clicks the arrows in the header here: <a href="http://thomasgrist.tumblr.com/" rel="nofollow">http://thomasgrist.tumblr.com/</a> they should scroll up and down through the Tumblr  .post 's</p>
