If you need to scroll the window to make an element into view, you can use the offset method to determine the location of the destination element relative to the document and then use the scrollTop method to scroll the document to bring the element into view.
For example, let’s say you want to scroll to the #links element when the user clicks the #related element:
jQuery('#related').click(function() {
var fooOffset = jQuery('#links').offset(),
destination = fooOffset.top;
jQuery(document).scrollTop(destination);
});