터치 이벤트 핸들러
function
startup() {
var
el = document.getElementsByTagName(
"canvas"
)[0];
el.addEventListener(
"touchstart"
, handleStart,
false
);
el.addEventListener(
"touchend"
, handleEnd,
false
);
el.addEventListener(
"touchcancel"
, handleCancel,
false
);
el.addEventListener(
"touchleave"
, handleLeave,
false
);
el.addEventListener(
"touchmove"
, handleMove,
false
);
}
function startup() {
var el = document.getElementById("prev");
el.addEventListener("touchstart", handleStart, false);
el.addEventListener("touchend", handleEnd, false);
function handleStart(){
this.className = "active";
}
function handleEnd(){
this.className = "";
}
}
window.onload = function(){
startup();
}
<button type="button" id="prev"><span>이전</span></button>
'자바스크립트' 카테고리의 다른 글
iframe 자바스크립트 호출 (0) | 2012.11.22 |
---|---|
탭연습 (0) | 2012.11.09 |
이벤트 버블링 (0) | 2012.08.23 |
하루동안 팝업띄우지않기 ( 체크후 닫기 버튼) (1) | 2011.04.25 |
팝업을 띄울때 (클릭시 바로 닫힘) (0) | 2011.04.22 |