event.timeStamp
event.timeStamp
설명 : 브라우저가 이벤트를 만든 시간과 1970 년 1 월 1 일 사이의 시간 차이 (밀리 초)입니다.
이 등록 정보는 event.timeStamp코드의 두 지점에서 값을 가져 와서 차이점 을 알면 이벤트 성능을 프로파일 링하는 데 유용 할 수 있습니다 . 이벤트 처리기 내에서 현재 시간을 간단하게 결정하려면 (new Date).getTime()대신에를 사용하십시오.
참고 : 2004 년부터 버그가 열려 있기 때문에이 값은 Firefox에서 올바르게 채워지지 않으므로 해당 브라우저에서 이벤트가 생성 된 시간을 알 수 없습니다.
예:
클릭 핸들러가 마지막으로 실행 된 이후의 시간을 표시합니다.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>event.timeStamp demo</title>
<style>
div {
height: 100px;
width: 300px;
margin: 10px;
background-color: #ffd;
overflow: auto;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div>Click.</div>
<script>
var last, diff;
$( "div" ).click(function( event ) {
if ( last ) {
diff = event.timeStamp - last;
$( "div" ).append( "time since last event: " + diff + "<br>" );
} else {
$( "div" ).append( "Click again.<br>" );
}
last = event.timeStamp;
});
</script>
</body>
</html>
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4526 | PHP | 8년 전 | 1963 | ||
| 4525 | PHP | 8년 전 | 1814 | ||
| 4524 | PHP | 8년 전 | 1980 | ||
| 4523 | 기타 |
프로그래머7
|
8년 전 | 14777 | |
| 4522 | OS |
프로그래머7
|
8년 전 | 3035 | |
| 4521 | jQuery |
프로그래머7
|
8년 전 | 2114 | |
| 4520 | jQuery |
프로그래머7
|
8년 전 | 2214 | |
| 4519 | jQuery |
프로그래머7
|
8년 전 | 2324 | |
| 4518 | jQuery |
프로그래머7
|
8년 전 | 2084 | |
| 4517 | jQuery |
프로그래머7
|
8년 전 | 2235 | |
| 4516 | jQuery |
프로그래머7
|
8년 전 | 3191 | |
| 4515 | PHP | 8년 전 | 2101 | ||
| 4514 | PHP | 8년 전 | 1879 | ||
| 4513 | PHP | 8년 전 | 2172 | ||
| 4512 | PHP | 8년 전 | 1932 | ||
| 4511 | PHP | 8년 전 | 2659 | ||
| 4510 | PHP | 8년 전 | 2353 | ||
| 4509 | jQuery |
프로그래머7
|
8년 전 | 2241 | |
| 4508 | jQuery |
프로그래머7
|
8년 전 | 2371 | |
| 4507 | jQuery |
프로그래머7
|
8년 전 | 1743 | |
| 4506 | jQuery |
프로그래머7
|
8년 전 | 1779 | |
| 4505 | jQuery |
프로그래머7
|
8년 전 | 1791 | |
| 4504 | jQuery |
프로그래머7
|
8년 전 | 2166 | |
| 4503 | PHP | 8년 전 | 2292 | ||
| 4502 | PHP | 8년 전 | 2156 | ||
| 4501 | PHP | 8년 전 | 2413 | ||
| 4500 | jQuery |
프로그래머7
|
8년 전 | 1835 | |
| 4499 | jQuery |
프로그래머7
|
8년 전 | 1775 | |
| 4498 | jQuery |
프로그래머7
|
8년 전 | 1659 | |
| 4497 | PHP | 8년 전 | 1659 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기