आप ड्रैगगेबल क्लास में टच इवेंट कैसे सेट अप करेंगे, ताकि यह आईओएस (आईपैड, आईफोन, इत्यादि) पर काम करे? मैंने How can I make a jQuery UI 'draggable()' div draggable for touchscreen? पढ़ा है, जिसमें jQuery के लिए बहुत सारे विकल्प हैं, लेकिन यह सुनिश्चित नहीं है कि इसे स्क्रिप्टैकुलस पर कैसे लागू किया जाए। किसी भी सहायता की सराहना की जाएगी। धन्यवाद।आईओएस पर स्क्रिप्टैकियस ड्रैगगेबल
Draggables में:
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);
}
},
खींचने योग्य में:
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") {
संपादन prototype.js के साथ साथ:
जो एक वोट वोट के लायक था। क्षमा करें, लेकिन अगर आप करेंगे, तो सीधे तरीकों को सीधे जोड़ना अच्छा उपयोग करना होगा, लेकिन क्या इसे मूल कार्यक्षमता संपादित नहीं माना जाएगा? यदि आप मुझे निर्णय लेने में मदद कर सकते हैं, तो मैं किसी अन्य ऐप पर प्रोटोटाइप पर संक्रमण कर सकता हूं और यह एकमात्र जगह है जिसे मैं किसी के बारे में बात कर सकता हूं। अच्छा बीमार काम करना चाहिए इसे एक भंवर देना और देखें कि मैं इसे केंद्रीय स्टार तक कितना ऊंचा कर सकता हूं। :-) – blamb