[jquery] [css] Dynamically position an object relative to another
//*** position object "that" 4px below object "this".
var thisTopPosition, thisHeight, thisBottomPosition, thatTopPosition;
thisTopPosition = $('#resultitem').offset().top; //*** use ".position().top" as alternative
thisHeight = $('#resultitem').height();
thisBottomPosition = thisTopPosition + thisHeight;
thatTopPosition = thisBottomPosition + 4;
$('<style>#ui-tooltip { top: ' + thatTopPosition + 'px; }</style>').appendTo('head');
//*** use the following code to perform scroll animation to position
$('html, body').animate({scrollTop: thatTopPosition }, 300);