The previous answer is almost correct. It won't quite work because the else statement won't hide the placeholder div in time. You need this:
function lockelem() {
if ($(window).scrollTop() > $('#tabs').position().top ) {
$('#tabs').css({'z-index': '10000', 'position': 'fixed', 'top': '0', 'width': '100%'});
$("#tabPlaceholder").show();
}
if ($(window).scrollTop() < $('#tabPlaceholder').position().top ) {
$('#tabs').css({'position': 'relative', 'top': 'auto'});
$('#tabPlaceholder').hide();
}
}
lockelem();
$(window).scroll(lockelem);
Working fiddle, you may need to resize the window to make it small enough to show it working: http://jsfiddle.net/rlouie/j7hsX/