<script src="~/resource/common/js/jquery-ui.min.js"></script> <script> //div draggable 처리 (function (b) { b.support.touch = "ontouchend" in document; if (!b.support.touch) { return; } var c = b.ui.mouse.prototype, e = c._mouseInit, a; function d(g, h) { if (g.originalEvent.touches.length > 1) { return; } g.preventDefault(); var i = g.originalEvent.changedTouches[0], f = document.createEvent("MouseEvents"); f.initMouseEvent(h, true, true, window, 1, i.screenX, i.screenY, i.clientX, i.clientY, false, false, false, false, 0, null); g.target.dispatchEvent(f); } c._touchStart = function (g) { var f = this; if (a || !f._mouseCapture(g.originalEvent.changedTouches[0])) { return; } a = true; f._touchMoved = false; d(g, "mouseover"); d(g, "mousemove"); d(g, "mousedown"); }; c._touchMove = function (f) { if (!a) return; this._touchMoved = true; d(f, "mousemove"); }; c._touchEnd = function (f) { if (!a) return; d(f, "mouseup"); d(f, "mouseout"); if (!this._touchMoved) { d(f, "click"); } a = false; }; c._mouseInit = function () { var f = this; f.element .bind("touchstart", b.proxy(f, "_touchStart")) .bind("touchmove", b.proxy(f, "_touchMove")) .bind("touchend", b.proxy(f, "_touchEnd")); e.call(f); }; })(jQuery); $(function () { $(".draggable").draggable(); }); </script>
하이브리드 앱에서 플로팅 이미지 이동 처리를 할 때 사용함.
'Script 이야기' 카테고리의 다른 글
jQuery load() 함수로 호출한 페이지의 스크립트 디버깅 (0) | 2016.04.05 |
---|---|
부호 있는 정수 세자리 수 처리. (0) | 2016.01.14 |
자바스크립트 스트링 포멧 함수 (0) | 2015.10.20 |
스크립트 페이징 처리. (0) | 2015.10.20 |
Ajax 호출로 갱신된 페이지 내부의 컨텐츠 뒤로 가기 버튼 눌렀을때 갱신 (0) | 2015.08.20 |