Effects - Stop() 메서드 (애니메이션 효과 멈추기)
.NET프로그래밍/jQuery 1.3.2 2009. 11. 12. 11:02 |
[Stop.htm]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>애니메이션 효과 멈추기</title>
<style type="text/css">
div {
position: absolute; background-color:#abc; left: 0px; top:50px;
width: 60px; height: 60px; margin: 5px;
}
</style>
<script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
// Start animation
$("#go").click(function() {
$(".block").animate({ left: '+=100px', top: '+=100px' }, 2000);
});
// Stop animation when button is clicked
$("#stop").click(function() {
$(".block").stop();
});
// Start animation in the opposite direction
$("#back").click(function() {
$(".block").animate({ left: '-=100px', top: '-=100px' }, 2000);
});
});
</script>
</head>
<body>
<button id="go">Go</button>
<button id="stop">STOP!</button>
<button id="back">Back</button>
<div class="block"></div>
</body>
</html>
-------------------------------------------------------------------------------------
[실행결과]
'.NET프로그래밍 > jQuery 1.3.2' 카테고리의 다른 글
WaterMarkTextBox (워터마크 텍스트박스 컨트롤 구현) (0) | 2009.11.12 |
---|---|
트리뷰(TreeView) 컨트롤 (0) | 2009.11.12 |
Effects - Animate() 메서드 (여러가지 효과 동시 처리) (0) | 2009.11.12 |
Effects - SlideToggle() 메서드 (슬라이드 업/다운) (0) | 2009.11.12 |
Effects - SlideUp() 메서드 (슬라이드업) (0) | 2009.11.12 |