SebaGR, 올바른 방향으로 나를 보내 주셔서 감사합니다. 패딩/마진에는 실제로 애니메이션을 반쯤 멈추는 말이있었습니다. 나는 여전히 요소 내부의 텍스트에 문제가 있었고, 결국에는 삭제되었지만 결국에는 대답을 찾았다. 또한 .information_messages
과 함께 wrapper-div를 추가하여 여러 개의 .information_message
요소를 허용합니다. 최종 결과는 다음과 같습니다
자바 스크립트 :
function hide(id){
dojo.byId(id).style.overflow = 'hidden';
dojo.animateProperty({
node: id,
duration: 500,
properties: {
height: {start: dojo.contentBox(id).h, end: 0},
margin: {end: 0},
marginBottom: {end: 0},
padding: {start: 10, end: 0},
paddingLeft: {end: 10 },
paddingRight: {end: 10 },
borderWidth: {start: 1, end: 0}
},
onEnd: function(){
dojo.query('#' + id).orphan();
// when all information_message elements are deleted, delete
// the information_messages container as well. Animate
// padding change to prevent sudden 'jump' on deletion.
if(dojo.query('.information_message').length == 0){
dojo.animateProperty({
node: dojo.query('#information_messages')[0],
duration: 500,
properties: {
padding: {start: 5, end: 0}
},
onEnd: function(){
dojo.query('#information_messages').orphan();
}
}).play();
}
}
}).play();
}
HTML :
<div id="information_messages">
<div class="information_message success" id="im1">
<a href="javascript:hide('im1');" class="right">Hide</a>
Success message 1
</div>
<div class="information_message error" id="im2">
<a href="javascript:hide('im2');" class="right">Hide</a>
Error message 1
</div>
</div>
CSS :
#information_messages {
padding: 5px;
}
.information_message {
margin-bottom:3px;
}
.error {
border: 1px solid #b2110a;
background-color: #f3dddc;
padding: 10px;
}
.success {
border: 1px solid #177415;
background-color: #d6f6d5;
padding: 10px;
}