반응형
jquery-ui 정렬 가능 | iPad / 터치 기기에서 작동시키는 방법?
iPad 및 기타 터치 장치에서 jQuery-UI 정렬 가능 기능을 사용하려면 어떻게해야합니까?
http://jqueryui.com/demos/sortable/
내가 사용하는 시도 event.preventDefault();
, event.cancelBubble=true;
및 event.stopPropagation();
와 touchmove
와 scroll
이벤트,하지만 결과는 페이지가 더 이상 이동하지 않는 것이 었습니다.
어떤 아이디어?
해결책을 찾았습니다 (지금까지 iPad로만 테스트되었습니다!)!
http://touchpunch.furf.com/content.php?/sortable/default-functionality
확인하려면 sortable
모바일 작업을. 다음 과 같이 터치 펀치를 사용 하고 있습니다.
$("#target").sortable({
// option: 'value1',
// otherOption: 'value2',
});
$("#target").disableSelection();
disableSelection();
정렬 가능한 인스턴스를 생성 한 후 추가에 유의하십시오 .
Tom, mouseProto._touchStart 이벤트 에 다음 코드를 추가 했습니다.
var time1Sec;
var ifProceed = false, timerStart = false;
mouseProto._touchStart = function (event) {
var self = this;
// Ignore the event if another widget is already being handled
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
return;
}
if (!timerStart) {
time1Sec = setTimeout(function () {
ifProceed = true;
}, 1000);
timerStart=true;
}
if (ifProceed) {
// Set the flag to prevent other widgets from inheriting the touch event
touchHandled = true;
// Track movement to determine if interaction was a click
self._touchMoved = false;
// Simulate the mouseover event
simulateMouseEvent(event, 'mouseover');
// Simulate the mousemove event
simulateMouseEvent(event, 'mousemove');
// Simulate the mousedown event
simulateMouseEvent(event, 'mousedown');
ifProceed = false;
timerStart=false;
clearTimeout(time1Sec);
}
};
반응형
'IT story' 카테고리의 다른 글
String.Contains ()가 String.IndexOf ()보다 빠릅니까? (0) | 2020.08.03 |
---|---|
SQL Server IN 대 기존 성능 (0) | 2020.08.03 |
Intellij IDEA, 프로젝트의 모든 코드 형식 (0) | 2020.08.03 |
"개발자 도구 액세스는 디버깅을 계속하려면 다른 프로세스를 제어해야합니다"경고 중지 (0) | 2020.08.03 |
numpy.histogram ()은 어떻게 작동합니까? (0) | 2020.08.03 |