2024-10-17

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script>
/*
- stop() : 선택한 요소에 효과 또는 애니메이션이 적용된 효과를 중지시키는 함수.
형식) $("요소 선택").stop();
-delay() : 선택힌 요소에 효과 또는 애니메이선이 적용된 효과를 지연시키는 함수.
형식) $("요소 선택").delay();
*/
$(function() {
$("h1").animate({marginLeft: "250px"}, 5000);
$("h2").delay(2000).animate({marginLeft: "250px"}, 3000);
$(".stop").on("click", function() {
$("h1").stop();
$("h2").stop();
});
});
</script>
</head>
<body>
<h1>내용1</h1>
<h2>내용2</h2>
<button class="stop">stop</button>
</body>
</html>

'JQuery > 기초 내용 정리' 카테고리의 다른 글
| JQuery(Exam)_01 (2) | 2024.10.17 |
|---|---|
| JQuery(Animation)_06 (0) | 2024.10.17 |
| JQuery(Animation)_05 (0) | 2024.10.17 |
| JQuery(Animation)_04 (0) | 2024.10.17 |
| JQuery(Animation)_03 (0) | 2024.10.17 |