• 회원가입
  • 로그인
  • 구글아이디로 로그인

[Effect] JQ - stop() 메서드 - 선택요소에 대해 현재 실행중인 애니메이션 중지 (= stop메서드 = 스톱메서드/스탑메서드)

목차

  1. stop() 예제 - stop()
  2. stop() 정의
  3. stop() 구문
  4. stop() 예제1 - stop(true)
  5. stop() 예제2 - stop(true,true)

 

stop() 예제 - stop()

※ stop() = stop(false,false)

※ 현재 animation만 바로 중지. 나머지는 실행.

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

  

<script> 

$(document).ready(function(){

  var hz = $("#hz");

  $("#start").click(function(){

    hz.animate({height: 300}, 3000);

    hz.animate({width: 300}, 3000);

    hz.animate({height: 100}, 3000);

    hz.animate({width: 100}, 3000);

  });

  $("#stop").click(function(){

    hz.stop();

  });

});

</script>

<style>

#hz {background:#98bf21;height:100px;width:100px}

</style>


<p>

<button id="start">Start (시작)</button>

<button id="stop">Stop (현재 애니만 중지, 나머지 애니는 실행)</button>

</p>


<div id="hz"></div>

 

결과보기

 

stop() 정의

 

선택한 요소에 대해 현재 실행중인 애니메이션을 중지.

※ 매개변수 이용해 다양한 방법으로 중지 가능.

 

 

stop() 구문

 

$(selector).stop(stopAll,goToEnd)

 


[매개변수]

 

stopAll

선택. 모든 animation 중지 여부 (예제1)

  • false : 모두 중지 X. (= 현재 것만 중지) (기본값)
  • true : 모두 중지 O

 

goToEnd

선택. 현재 animation 완성 여부 (예제2)

  • false : 현재 완성 X (= 바로 중지 O)
  • true : 현재 완성 O (= 바로 중지 X)

 

 

stop() 예제1 - stop(true)

※ stop(true) = stop(true, false)

※ 모두 바로 중지.

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<script>  

$(document).ready(function(){

  var hz = $("#hz");

  $("#start").click(function(){

    hz.animate({height: 300}, 3000);

    hz.animate({width: 300}, 3000);

    hz.animate({height: 100}, 3000);

    hz.animate({width: 100}, 3000);

  });

  $("#stop").click(function(){

    hz.stop(true);

  });

});

</script>


<style>

#hz {background:#98bf21;height:100px;width:100px}

</style>


<p>

<button id="start">Start (시작)</button>

<button id="stop">Stop (모든 애니 바로 중지)</button>

</p>


<div id="hz"></div>

 

결과보기

 

stop() 예제2 - stop(true,true)

※ 모두 바로 중지하되, 현재 것은 끝까지 완성.

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<script>  

$(document).ready(function(){

  var hz = $("#hz");

  $("#start").click(function(){

    hz.animate({height: 300}, 3000);

    hz.animate({width: 300}, 3000);

    hz.animate({height: 100}, 3000);

    hz.animate({width: 100}, 3000);

  });

  $("#stop").click(function(){

    hz.stop(true, true);

  });

});

</script>


<style>

#hz {background:#98bf21;height:100px;width:100px}

</style>


<p>

<button id="start">Start (시작)</button>

<button id="stop">Stop (모든 애니 바로 중지, 단 현재 애니는 완성)</button>

</p>


<div id="hz"></div>

  

결과보기



분류 제목
Property JQ - jquery 속성 - 제이쿼리버전번호 (= jQuery버전번호 = JQ버전번호)
Property JQ - jQuery.fx.interval 속성 - 애니메이션 점화빈도를 밀리초단위로 변경
Property JQ - jQuery.fx.off 속성 - 애니메이션 비활성화/활성화
Property JQ - jQuery.support 속성 - 브라우저 기능/버그 표시 속성모음 (jQuery 내부용)
Property JQ - length 속성 ★ - 객체의 요소개수 (= length속성 = 렝스속성) ※ 입력 내용 일정 길…
ETC JQ - 인풋계산값 자동입력 (= INPUT입력값 자동계산 = 필드계산결과 자동입력 = 연산자동입력) ★★★…
Misc JQ - 검색필터링 (= 일치값 찾기)
ETC JQ - draggable() 메서드 - 요소드래그이동 (= 요소이동 = 요소끌어이동 = Drag & Dro…
jquery JQ - 얼럿창 (= 다이얼로그창)
basic JQ - JS변수 vs JQuery변수
basic JQ - 링크클릭이동 : href속성 + replace()메서드
Examples JQ - 리스트랜덤 (= 목록랜덤)
Selector JQ - this 선택자 - 현재 요소 선택. (= 디스 선택자)
Examples JQ - (부모요소・자식요소) 데이터값・입력값 변경
ETC JQ - 링크 (새창→ 현재창), (현재창→새창)으로 타겟 변경.
ETC JQ - 두 요소에 동시 입력 ★★★ (= Simultaneous Auto Multi Input)
ETC JQ - number_fommat() 구현. (= 넘버포맷 = 숫자 입력 시, 바로 천자리마다 쉼표 찍기)
ETC JQ - (입력・선택) 숫자 만큼 인풋 체크박스 체크.
ETC JQ - 스크롤 시, (배경색 변경 + 불투명도 조절) (= scroll background opacity …
ETC JQ - play(), pause() 메서드 - jquery 문법으로 처리하기
14/15
목록
찾아주셔서 감사합니다. Since 2012