views:

94

answers:

0

Hi,

I working with scriptaculous in my web solution and use one slider for range selection. I have ported to iphone and changed event listeners to touchstart, touchmove, touchend in place of mousevents but nothing is working as need. I have moved to some others to click events but same issue. Click event is starting but later is not correctly. Someone has extended this Slider to use in iphone touch web.

Thanks for you tips.

extending scriptaculous slider class as SliderTouch

`this.onTouchStart = this.startDrag.bindAsEventListener(this); this.onTouchEnd = this.endDrag.bindAsEventListener(this); this.onTouchMove = this.update.bindAsEventListener(this);

this.handles.each( function(h,i) {
  i = slider.handles.length-1-i;
  slider.setValue(parseFloat(
    (slider.options.sliderValue instanceof Array ? 
      slider.options.sliderValue[i] : slider.options.sliderValue) || 
     slider.range.start), i);
  Element.makePositioned(h);
  Event.observe(h, "click", slider.onTouchStart);
  Event.observe(h, "touchend", slider.onTouchEnd);
});    
//Event.observe(this.track, "touchstart", this.onTouchStart);
Event.observe(document, "touchmove", this.onTouchMove);

this.initialized = true;

}, dispose: function() { var slider = this;
Event.stopObserving(document, "touchmove", this.onTouchMove); this.handles.each( function(h) { Event.stopObserving(h, "click", slider.onTouchStart); Event.stopObserving(h, "touchend", slider.onTouchEnd);
}); },`