jquery 타이머 만들기
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script>
function setTimer(selector,startValue,endValue,durationTime){
$(selector).animate(
{
to:startValue,
from:endValue
},
{
duration:durationTime,
step:function(idx){
$(this).text(Math.floor(idx));
}
}
);
}
$(function(){
setTimer(".timer1",0,500,1000);
setTimer(".timer2",0,5000,2000);
setTimer(".timer3",0,50000,3000);
setTimer(".timer4",0,500000,4000);
setTimer(".timer5",0,5000000,5000);
// 선택자,시작값,끝값,지연시간
});
</script>
<div class='timer1'></div>
<div class='timer2'></div>
<div class='timer3'></div>
<div class='timer4'></div>
<div class='timer5'></div>
animate함수로 간단하게 구현이 가능 합니다.
댓글 2개
감사합니다.
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4976 | 기타 | 5년 전 | 2118 | ||
| 4975 | 웹서버 |
nooree
|
5년 전 | 2762 | |
| 4974 | node.js |
younhoso
|
5년 전 | 2135 | |
| 4973 | PHP |
|
5년 전 | 3638 | |
| 4972 | 기타 |
younhoso
|
6년 전 | 2260 | |
| 4971 | JavaScript | 6년 전 | 2488 | ||
| 4970 | 웹서버 | 6년 전 | 4120 | ||
| 4969 | JavaScript |
|
6년 전 | 2783 | |
| 4968 | JavaScript |
|
6년 전 | 1933 | |
| 4967 | JavaScript |
younhoso
|
6년 전 | 2041 | |
| 4966 | JavaScript |
|
6년 전 | 2115 | |
| 4965 | PHP |
|
6년 전 | 2104 | |
| 4964 | 기타 | 6년 전 | 2919 | ||
| 4963 | JavaScript | 6년 전 | 2088 | ||
| 4962 | JavaScript | 6년 전 | 2285 | ||
| 4961 | jQuery |
아이티몬스
|
6년 전 | 2094 | |
| 4960 | PHP | 6년 전 | 2738 | ||
| 4959 | 기타 | 6년 전 | 2566 | ||
| 4958 | PHP |
아이티몬스
|
6년 전 | 4577 | |
| 4957 | 기타 | 6년 전 | 2094 | ||
| 4956 | 정규표현식 |
하늘위의길
|
6년 전 | 2321 | |
| 4955 | 정규표현식 |
하늘위의길
|
6년 전 | 2674 | |
| 4954 | 웹서버 |
하늘위의길
|
6년 전 | 4138 | |
| 4953 | PHP | 6년 전 | 2524 | ||
| 4952 | PHP |
몰라무서워
|
6년 전 | 3212 | |
| 4951 | MySQL | 6년 전 | 4129 | ||
| 4950 | jQuery | 6년 전 | 3613 | ||
| 4949 | node.js | 6년 전 | 2678 | ||
| 4948 | node.js | 6년 전 | 2402 | ||
| 4947 | node.js | 6년 전 | 2647 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기