The jQuery documentation for .offest()reads:
.offset () returns an object containing properties on the top and left.
Knowing this, you can do the following:
var offset = $("#layer2").offset();
$("#layer1").css({
'top' : offset.top,
'left': offset.left
});
Or you can install them individually, according to your requirement.
$("#layer1").css('top', offset.top); // or...
$("#layer1").css('left', offset.left);
Finally, since you only need one value (above), the offset is redundant; it is more expensive than you need. Use the following optimized snippet instead.
var top = $('#layer2').css('top');
$('#layer1').css('top', top);