.offset([coordinates])
method set the coordinates of an element but only relative to the document. Then how can I set coordinates of an element but relative to the parent?
I found that .position()
method get only "top,left" values relative to the parent, but it doesn't set any values.
I tried with
$("#mydiv").css({top: 200, left: 200});
but does not work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…