Вот скрипт
| Код | var last_move = {x:0,y:0}; function touchHandler(event) {
var touches = event.changedTouches, first = touches[0], type = ""; switch(event.type) { case "touchstart": type = "mousedown"; break; case "touchmove": type="mousemove"; break; case "touchend": type="mouseup"; break; default: return; }
//initMouseEvent(type, canBubble, cancelable, view, clickCount, // screenX, screenY, clientX, clientY, ctrlKey, // altKey, shiftKey, metaKey, button, relatedTarget);
var simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null);
first.target.dispatchEvent(simulatedEvent);
if(type == 'mousemove'){ if(first.clientY !== last_move.y){
event.preventDefault(); } } if(type == 'mouseup'){ last_move.y = first.clientY; //lines.hoverInput(true,$(this).attr('id')); //lines.closeLine(); statusBar(event.object) }
if(event.target.class == 'output'){ $('.drag').draggable('disable');
} else{ $('.drag').draggable('enable'); }
}
function init_touch() { document.addEventListener("touchstart", touchHandler, true); document.addEventListener("touchmove", touchHandler, true); document.addEventListener("touchend", touchHandler, true); document.addEventListener("touchcancel", touchHandler, true); } init_touch();
|
Есть event, вот теперь мне нужно получить свойства обьекта к примеру : $(object).attr('id') вот как мне найти обьект из event, возможно this но не работает, пробую на планшете ) |