0
생성 된 요소를 주기적으로 컨테이너로 밀어 넣으려고합니다. jQuery의 .animate()를 사용하려고합니다.요소를 컨테이너로 밀어 넣기
나는 지금까지 무엇을 가지고 :
이<div id="mainContainer">
</div>
<div id="photoContainer" class="photocontclass" style="display:none">
<img id="image" src="@Url.Action("Photo_Read", new { Id = 1})" />
</div>
<script>
var photoId = 2;
$(document).ready(function() {
setInterval(function() { getPhoto() }, 3000);
});
function getPhoto() {
$("#photoContainer #image").attr("src", '@Url.Action("Photo_Read")' + '/' + photoId);
var $new = $('#photoContainer').clone().attr("id", "photoContainer" + photoId);
$('#timelineContainer').prepend($new);
$new.show('slow');
// do animation with animate...
$new.animate({
left:'-50%' // which properties should I have?
}, 2000, "swing", function() {
$(this).remove();
});
photoId++;
} </script>
<style>
.photocontclass {
display:inline;
margin:10px;
background-color:white;
padding:5px;
position:absolute;
}
#timelineContainer {
background-color:grey;
height:200px;
width:100%;
margin:10px;
padding:10px;
}
</style>
$("#photoContainer")
컨테이너의 오른쪽에서오고, 왼쪽에 나올한다 ...이 제거되어야 후 ...
좀 의심이 :
나는mainContainer
에와
photoContainer
에 있어야한다 CSS 속성
- (왼쪽 위치, 등)?
photoContainer
을mainContainer
의 내부 또는 외부에 배치해야합니까?- 어떤 속성이 애니메이션 메서드에 있어야합니까?
가능한 복제본 : http://stackoverflow.com/q/15063125/86072. 이 다른 질문이 당신 대답입니까? – LeGEC