.offset()
will return the offset position of an element as a simple object, eg:
(.offset()
将元素的偏移位置作为简单对象返回,例如:)
var position = $(element).offset(); // position = { left: 42, top: 567 }
You can use this return value to position other elements at the same spot:
(您可以使用此返回值将其他元素定位在同一位置:)
$(anotherElement).css(position)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…