rochal / jQuery-slimScroll

small jQuery plugin that transforms any div into a scrollable area with a nice scrollbar. Demo and more:
http://rocha.la/jQuery-slimScroll
2.23k stars 927 forks source link

Nested scrolling areas scroll together #125

Open amsross opened 10 years ago

amsross commented 10 years ago

This was brought up and fixed in issue #11 and pr #49 but seems to have been 'unfixed' at some point.

Am I perhaps misconfiguring something?

kaulgud commented 10 years ago

the same issue happens for touch screen devices.

I fixed it by applying the same code in the touchmove event and it works perfectly fine.

me.bind('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 diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep; // scroll content var target = e.target || e.srcTarget || e.srcElement; if ($(target).closest('.' + o.wrapperClass).is(me.parent())) { scrollContent(diff, true); } touchDif = e.originalEvent.touches[0].pageY; } });