[jQuery] problem with scrolling - offset function

[jQuery] problem with scrolling - offset function


Hi everyone
I was trying to do a simple navigation for my main page. Everytime
when I click image with class next it Should scroll to the next h3
element. I've got such a piece of source code:
$(document).ready(function() {
    $("img.next").click(
        function(){
         var pos = $("h3").offset();
         $("html").animate({ scrollTop: pos.top + "px" }, { duration:
1000 });
    });
});
And when I am clicking on the image witch has got a class="next" my
page scrolls only once. I tried to use
var pos = $("h3:eq(x)").offset();
with incrementing x variable but it doesn't work. Please help me.
Regards
Paul