I have made an Image gallery. As you can see in the picture, I have Image thumbnails on the right side. Now I want that div to scroll with the big pic. I mean when ever someone clicks next the thumbnail div should scroll to the thumbnail of the next pic. I am using
$(".slider_thumbnail").animate({scrollTop: $('#thumbnail_div #'+current).position().top});

But it works for the first click then doesn't for second and then works again for third and so on.