Ok, let's break it down:
You probably know about the problem with animations stacking up and that if someone kept hammering on the right or left buttons of your scroller, then it would scroll way past the position it was meant to.
Well, this bit here, says to filter the selection, only to include elements that are not being animated. That way we avoid the problem altogether:
Then we pass an anonymous callback to
animate(), so that we can update the scroller's current position, once the animation has completed.
The current position is obtained, thus:
currentPosition = Math.abs(parseInt($thumbsContainer.css('left')));
Working from the inside out:
will give us a pixel value between 0 and minus the width of the thumbs container. This will be a string.
parseint() to this value, as it will parse a string (ignoring the 'px') and returns an integer value.
We then use Math.abs() to turn a potential negative number into a positive one.
And that's it!
Does that all make sense?
You might also want to read: http://css-tricks.com/full-jquery-animations/