Slimscroll bar very slow in mobile browser
Asked Answered
C

2

7

I am using the slimscrollbar plugin. It is working fine in Web Browser, but its very slow in mobile browser.

Any solution to increase the speed that work for mobile?

Convulsant answered 13/10, 2014 at 7:24 Comment(1)
Did you get it working faster? touchScrollStep is not working for me.Peatroy
J
11

If you have used the slimscrollbar plugin found here: http://rocha.la/jQuery-slimScroll you may want to change the setting of "touchScrollStep" to round 50.

The default is 200 which is pretty slow, less than 200 is faster and -200 is inverted scrolling "natural".

Some code:

$('#slimscroll').slimScroll({
   size: '5px',
   height: '600px',
   alwaysVisible: false,
   touchScrollStep: 50
});

Cheers, david

Judicative answered 10/12, 2014 at 14:55 Comment(0)
B
1

Change the touchScrollStep does not work for me. I've modified the touchmove event, and remove the divided by touchScrollStep. The original code is:

var diffX = (touchDifX - e.originalEvent.touches[0].pageX) / o.touchScrollStep;

var diffY = (touchDifY - e.originalEvent.touches[0].pageY) / o.touchScrollStep;

now the touchmove event code like this which works in my case:

      me.on('touchmove', function(e){
      // prevent scrolling the page if necessary
      if(!releaseScroll)
      {
          e.originalEvent.preventDefault();
      }
      if (e.originalEvent.touches.length)
      {
        // see how far user swiped
        var diffX = (touchDifX - e.originalEvent.touches[0].pageX);
        var diffY = (touchDifY - e.originalEvent.touches[0].pageY);

        // scroll content
        scrollContent(diffX, diffY, true);
        touchDifX = e.originalEvent.touches[0].pageX;
        touchDifY = e.originalEvent.touches[0].pageY;
      }
    });
Bistre answered 19/7, 2017 at 3:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.