The offset method returns an object with a top and left property.

$('#myDiv').offset() => { top: 100, left: 100 }

Since the .css() method can take an object you can just pass the
result of .offset() directly to .css().

var offset = $('#myDiv').offset();
$('#myOtherDiv').css( offset );

You could also manually assign it with something like this:

var offset = $('#myDiv').offset();
$('#myOtherDiv').css('top', offset.top).css('left', offset.left);

Or even like this:

var offset = $('#myDiv').offset();
$('#myOtherDiv').css({ top: offset.top, left: offset.left });

--
Brandon Aaron

On 5/16/07, Skilip <[EMAIL PROTECTED]> wrote:

Hi,

With the plugin 'dimensions' I figured out how to get the position of
an element. But what do I have to do to set it?


Reply via email to