2011年5月10日 星期二

HTML on Touch Device


var supportTouch = "ontouchend" in document,
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
touchMoveEvent = supportTouch ? "touchmove" : "mousemove",
touchStopEvent = supportTouch ? "touchend" : "mouseup";

//以上為偵測裝置是否有支援touch,有則用touch沒有則用mouse。

$touchpad.bind(touchStartEvent, function(e) {
//Your Code Here
});
$touchpad.bind(touchMoveEvent, function(e) {
//Your Code Here
});
$touchpad.bind(touchStopEvent, function(e) {
//Your Code Here
});



Touch In This Area!

沒有留言:

張貼留言