asafdav / ng-scrollbar

A custom scrollbar written in pure AngularJS
MIT License
187 stars 70 forks source link

scrolling in mobile device #23

Closed badoet closed 8 years ago

badoet commented 10 years ago

is the touch event only limited to the scroll bar area? it cant do the touch the content area and drag to scroll right? or am i missing something?

csablons commented 10 years ago

Yes I confirm it's limited to the scroll area..

SinnerAir commented 10 years ago

+1

ehsan89 commented 8 years ago

I just set it to the default browser scroll bar when a touch device is detected.

asafdav commented 8 years ago

Hi @ehsan89, would you mind amending the README to help others avoid this in the future ?

CosyStudios commented 8 years ago

Whats the best outcome for people here? I've completly hidden the scrollbar area for neatness and was expecting scroll to work on the content. touching a scrollbar rather than the content area seems pretty ludicrous, especially if its a sharp , thin one! Might do a pull and modify...

CosyStudios commented 8 years ago

Heres a cheeky fix...... REPLACE

thumb.on('touchstart', function (event) {
              lastOffsetY = event.originalEvent.changedTouches[0].pageY - thumb[0].offsetTop;
              win.on('touchend', _touchEnd);
              win.on('touchmove', _touchDragHandler);
              event.preventDefault();
            });

with transculdedContainer.on('touchStart).......

AND

--- yes this works, but the action is opposite what is expected from a direct touch so altered code should be as above, replacing thumb with transcludedContainer

so changing the thumbDrag handler from

var thumbDrag = function (event, offsetX, offsetY) {
          dragger.top = Math.max(0, Math.min(parseInt(dragger.trackHeight, 10) - parseInt(dragger.height, 10), offsetY));
          event.stopPropagation();
        };

to

var thumbDrag = function (event, offsetX, offsetY) {
          dragger.top = Math.max(0, Math.min(parseInt(dragger.trackHeight, 10) - parseInt(dragger.height, 10), **-**offsetY));
          event.stopPropagation();
        };

(ammended a '-' to offsetY)