简体   繁体   中英

Is there anyway to stop scrolling programmatically?

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() ?

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM