div 애니메이션

2015. 5. 29. 15:24Web



336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
$('#example').animate({
    'marginLeft' : "+=50px"
});



$('#example').animate({
    'marginLeft' : "-=50px"
});


<script language="javascript">
function example_animate(px) {
	$('#example').animate({
		'marginLeft' : px
	});
}
</script>
<input type="button" value="Move Left" onclick="example_animate('-=50px')" />
<input type="button" value="Move Right" onclick="example_animate('+=50px')" />
<div id="example" style="border: 1px solid black; margin: 10px 0px; padding: 10px; background-color: rgb(238, 238, 238); width: 200px; text-align: center;">This is going to move</div>










출처 : http://www.electrictoolbox.com/jquery-relative-move-div-left-right/

'Web' 카테고리의 다른 글

[javascript] HTML TITLE 변경하기  (0) 2015.07.08
table tr display none / block 시 크롬 깨짐현상  (0) 2015.07.07
[PHP] 문자열 검색  (0) 2015.05.22
택배 배송추적 URL  (0) 2015.05.22
[Jquery] For - Continue, Break  (0) 2015.04.29