1
Heyho 다시, 두 요소가 있는데 두 번째 요소와 관련하여 그 중 하나를 배치하려고합니다 :-) "jquery ui .position()"을 (를) 사용하고자합니다. 그에 대한. 여기에 내가 가진 무엇 :jQuery UI 위치가있는 다른 요소의 위치 요소
<div id="testparent">Parent</div>
<div id="testchild">Child</div>
#testparent{
position: absolute;
margin:100px auto auto auto;
width:300px;
height:120px;
background:lime;
}
#testchild{
margin:auto;
width:60px;
height:90px;
background:yellow;
}
$('#testchild').position({
of: $('#testparent'),
my: "left top",
at: "left bottom",
offset: "0 3"
});
내가 testchild가 testparent 아래/위의 위치가되고 싶어요. 문제는 내가 부모에 상대적으로 수평으로 배치하고 싶지는 않지만 수직으로 배치하는 것입니다. 가능합니까 :-) ??
예, 내 문제를 해결했습니다. 내가해야만하는 변화 : 소품은 정의되지 않았습니다. 그래서 "요소"매개 변수가 충분하고'$ ('# testchild') 여야합니다. css ("top", element.top); –
맞아요, 함수는 하나의 인수 만 취하고 'this'는 요소에 바인딩됩니다. 그에 따라 내 대답을 업데이 트되었습니다. –