0

This is disabling all scroll functionality.

var myScroller = new IScroll('#wrapper');
myScroller.disable();

Is there any way to stop scrolling(not disable iscroll)?

var myScroller = new IScroller('#wrapper');
myScroller.stopScroll() ?
myScroller.preventScroll() ?
myScroller.stayFixed() ?
Kirk Beard
  • 8,124
  • 12
  • 39
  • 43
Kim
  • 3,985
  • 4
  • 29
  • 53

1 Answers1

0

Did you try reading the documentation? Don't just try to guess the name of a function. Perhaps this will help you:

options.disableMouse options.disablePointer options.disableTouch

By default iScroll listens to all pointer events and reacts to the first one that occurs. It may seem a waste of resources but feature detection has proven quite unreliable and this listen-to-all approach is our safest bet for wide browser/device compatibility.

If you have an internal mechanism for device detection or you know in advance where your script will run on, you may want to disable all event sets you don't need (mouse, pointer or touch events).


IScroll isn't designed to prevent scrolling, so if that's what you're using it for, ditch it. Even if you still want IScroll for when scrolling is enabled, perhaps this could help you: How to disable scrolling temporarily?

Clonkex
  • 2,821
  • 5
  • 33
  • 47
  • I think there is a misunderstanding. I have already initiate IScroll and got instance 'myScroller', what I mean is how to disable scroll movement by using this 'myScroll' instance. I have edited my question. – Kim Jun 16 '17 at 06:39
  • @Kim Well IScroll isn't designed to _prevent_ scrolling. Was that the only reason you used IScroll? – Clonkex Jun 16 '17 at 06:50
  • Actually, there are [modal/mask](https://github.com/jsor/lity) show up dynamically on this scroll div. I want to prevent scroll movement when modal/mask is opened. Maybe I should work on how to prevent touch through event(when modal is open) other than prevent IScroll scroll movement. But thank you anyway! – Kim Jun 16 '17 at 07:03
  • @Kim What most people do when creating a modal popup is to also create an invisible (or sometimes partially-visible) overlay over the whole page but behind the popup. That way clicks and other events can be eaten up by the overlay. – Clonkex Jun 16 '17 at 12:31