제이쿼리 .clearQueue ([queueName])
제이쿼리 .clearQueue ([queueName])
설명 : 아직 실행되지 않은 모든 항목을 대기열에서 제거하십시오.
.clearQueue()메소드가 호출되어 실행되지 않은 대기열에 모든 함수는 큐로부터 제거된다. 인수없이 사용 하면 표준 효과 대기열 .clearQueue()에서 나머지 기능을 제거합니다 fx. 이 방법으로 그것은 비슷합니다 .stop(true). 그러나이 .stop()메소드는 애니메이션과 함께 사용하기위한 것이지만 메소드를 사용 .clearQueue()하여 일반 jQuery 대기열에 추가 된 모든 함수를 제거하는 데에도 사용할 수 있습니다 .queue().
예:
대기열을 비우십시오.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>clearQueue demo</title>
<style>
div {
margin: 3px;
width: 40px;
height: 40px;
position: absolute;
left: 0px;
top: 30px;
background: green;
display: none;
}
div.newcolor {
background: blue;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<button id="start">Start</button>
<button id="stop">Stop</button>
<div></div>
<script>
$( "#start" ).click(function() {
var myDiv = $( "div" );
myDiv.show( "slow" );
myDiv.animate({
left:"+=200"
}, 5000 );
myDiv.queue(function() {
var that = $( this );
that.addClass( "newcolor" );
that.dequeue();
});
myDiv.animate({
left:"-=200"
}, 1500 );
myDiv.queue(function() {
var that = $( this );
that.removeClass( "newcolor" );
that.dequeue();
});
myDiv.slideUp();
});
$( "#stop" ).click(function() {
var myDiv = $( "div" );
myDiv.clearQueue();
myDiv.stop();
});
</script>
</body>
</html>
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4766 | jQuery | 8년 전 | 1676 | ||
| 4765 | jQuery | 8년 전 | 1349 | ||
| 4764 | jQuery | 8년 전 | 2165 | ||
| 4763 | jQuery | 8년 전 | 1853 | ||
| 4762 | jQuery | 8년 전 | 1629 | ||
| 4761 | jQuery | 8년 전 | 1932 | ||
| 4760 | jQuery | 8년 전 | 1297 | ||
| 4759 | jQuery | 8년 전 | 1597 | ||
| 4758 | jQuery | 8년 전 | 1310 | ||
| 4757 | jQuery | 8년 전 | 1275 | ||
| 4756 | jQuery | 8년 전 | 1496 | ||
| 4755 | jQuery | 8년 전 | 1647 | ||
| 4754 | jQuery | 8년 전 | 1613 | ||
| 4753 | jQuery | 8년 전 | 1769 | ||
| 4752 | jQuery | 8년 전 | 1519 | ||
| 4751 | jQuery | 8년 전 | 1839 | ||
| 4750 | jQuery | 8년 전 | 1981 | ||
| 4749 | jQuery | 8년 전 | 1441 | ||
| 4748 | PHP | 8년 전 | 2809 | ||
| 4747 | jQuery | 8년 전 | 1390 | ||
| 4746 | jQuery | 8년 전 | 1646 | ||
| 4745 | jQuery | 8년 전 | 1653 | ||
| 4744 | jQuery | 8년 전 | 1533 | ||
| 4743 | jQuery | 8년 전 | 1612 | ||
| 4742 | jQuery | 8년 전 | 1705 | ||
| 4741 | jQuery | 8년 전 | 1597 | ||
| 4740 | jQuery | 8년 전 | 1606 | ||
| 4739 | jQuery | 8년 전 | 1797 | ||
| 4738 | jQuery | 8년 전 | 1308 | ||
| 4737 | jQuery | 8년 전 | 2097 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기