How do I use the properties created by an animate function in that animate function's callback?
===

I'm working on a page that will have a series of images on it.  Each image will be in a container, and each container will be floated left.  Since the images will have varying widths, there's no way of knowing how many images will be on each row.  When a visitor clicks on an image, it and it's container will expand.

In some situations, this expansion means the clicked image will jump to the following row, and will leave the screen because of it.  I'm looking for a way of having the screen follow the clicked image wherever it goes.  

Here's my code thus far:

    <script type="text/javascript">
	$(document).ready(function(){
		$(".ExampleImage").toggle(
			function(){
				var Image = $(this);
				var Container = $(this).closest(".ImageContainer");
				Image.switchClass("ExampleImageContracted","ExampleImageExpanded",500);
				Container.css('height','auto');
				Image.queue(scrollToExample(Image));
			},
			function(){
				var Image = $(this);
				var Container = $(this).closest(".ImageContainer");
				Image.switchClass("ExampleImageExpanded","ExampleImageContracted",500);
				Container.animate({'height':'250'},500,scrollToExample(Image));
			}
		);
		
		function scrollToExample(Image) {
			var NewTop = $(Image).closest(".Example").offset();			
			$('html, body').animate( {
				scrollTop:NewTop.top
			}, 1000);	
		}
	});
    </script>

Note that I've used both a callback in the `.animate` and also a `.queue` in an attempt to sequence this correctly.  Unfortunately, the value this pulls in for the image container's `.offset` is the *old* top, and not the one that occurs after the animation.  I'm looking for a way of getting the container's top once the animation has completed.  Any advice would be very appreciated. 

If you'd like to see the above code in action, here's a link.  Note that when you arrive at the page and click Example 4, the screen does not scroll down to Example 4's new location.

 [http://notiondigitalarts.com/ImageEnlargeTest/][1]


  [1]: http://notiondigitalarts.com/ImageEnlargeTest/
