タッチイベントをドラッグ可能なクラスに設定して、iOS(iPad、iPhoneなど)で動作させる方法を教えてください。私はHow can I make a jQuery UI 'draggable()' div draggable for touchscreen?を読んでいますが、これにはjQueryのオプションがたくさんありますが、それをScriptaculousにどのように適用するかはわかりません。どんな助けもありがとう。ありがとう。 DraggablesでiOSでドラック可能なScriptaculous
:ドラッグ可能で
register: function(draggable) {
if(this.drags.length == 0) {
this.eventMouseUp = this.endDrag.bindAsEventListener(this);
this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
this.eventKeypress = this.keyPress.bindAsEventListener(this);
Event.observe(document, "mouseup", this.eventMouseUp);
Event.observe(document, "mousemove", this.eventMouseMove);
Event.observe(document, "keypress", this.eventKeypress);
Event.observe(document, "touchstart", this.eventKeypress);
Event.observe(document, "touchmove", this.eventMouseMove);
Event.observe(document, "touchend", this.eventMouseUp);
}
this.drags.push(draggable);
},
unregister: function(draggable) {
this.drags = this.drags.reject(function(d) { return d==draggable });
if(this.drags.length == 0) {
Event.stopObserving(document, "touchstart", this.eventKeypress);
Event.stopObserving(document, "touchmove", this.eventMouseMove);
Event.stopObserving(document, "touchend", this.eventMouseUp);
Event.stopObserving(document, "mouseup", this.eventMouseUp);
Event.stopObserving(document, "mousemove", this.eventMouseMove);
Event.stopObserving(document, "keypress", this.eventKeypress);
}
},
:編集prototype.jsのと一緒に
initialize:
...
this.eventMouseDown = this.initDrag.bindAsEventListener(this);
Event.observe(this.handle, "mousedown", this.eventMouseDown);
Event.observe(this.handle, "touchstart", this.eventMouseDown);
Draggables.register(this);
},
destroy: function() {
Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
Event.stopObserving(this.handle, "touchstart", this.eventMouseDown);
Draggables.unregister(this);
},
...
initDrag: function(event) {
if(!Object.isUndefined(Draggable._dragging[this.element]) &&
Draggable._dragging[this.element]) return;
if(Event.isLeftClick(event) || event.type == "touchstart") {
:
これは投票に値するものでした。申し訳ありませんが、もしあなたが望むのであれば、メソッドを直接操作するだけの良い使い方について言わざるを得ませんでしたが、コアの機能を編集するとは思われませんでしたか?あなたが私の決定を助けることができるなら、私は別のアプリでプロトタイプに移行するかもしれません。そして、それが誰かがそれについて話すことができる唯一の場所です。うまくいけば、それは渦巻きをして、中央の星にどれくらいの高さをあげられるかを見てください。 :-) – blamb