cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

disable snap temporarily ? or change settings on the fly ? #1019

Open commonpike opened 8 years ago

commonpike commented 8 years ago

With snap enabled (and set to a classname), on resize, iScroll jumps backs to the top (myScroll.y = 0). Its part of a complex page, so the issue might be somewhere else.

With snap disabled, this works fine, so I'm trying to disable snap on resize before iScroll notices the resize, and reenable snap or refresh after it noticed the resize.

Is that possible ?

commonpike commented 8 years ago

.. actually working around it now by clearing a thing called resizeTimeout 'just in time', and handling a refresh and scrollTo myself. Seems to bypass the resize handler in iScroll.

myFramework.onResize : function() {
  clearTimeout(myScroll.resizeTimeout);
  myScroll.refresh();
  myFramework.doStuffAndRepairTheScroll();

I just need to set myFramework's resizePolling slightly quicker then iScrolls resizePolling.