lets say I have this:
var infoBox = $(".info");
lets say then I am expanding one infoBox and I want the document to scroll to the top of that infoBox sot hat I can see its whole content.
I know i should first find the offset, the distance of infoBox from the top and left of the document and I also know offset() returns top and left.
Is this what should do then?
var offset = infoBox.offset();
$(document).scrollTo(offset.top);
Almost!
See jQuery.scrollTop.