mercredi 22 juin 2016

Cordova - iOS nested element disable bounce but keep velocity scrolling

I have a Cordova app which has a scrollable content on one of the screens. I have a div with overflow:scroll and -webkit-overflow-scroll:touch and all is well. Velocity scrolling (native-style) works fine. This is on iOS 9.3. The html and body do not scroll (height:100% and overflow:hidden).

The problem I'm having is the "bounce" effect both when the scrolling has momentum and hits the start/end, and when the user continues pulling on the content. I want to disable both the momentum bounce and the user-pull bounce, while maintaining velocity scrolling. I've tried all of the solutions that I've been able to find online so far:

  • Adding prefs to config.xml - DisallowOverscroll, webviewbounce, UIWebViewBounce
  • CSS changes - combinations of overflow on parent/child
  • JavaScript acrobatics - catching touchstart and calling preventDefault under certain conditions, resetting scrollTop to 0, etc. etc.
  • Native code changes - settings bounces to no, iterating over "SubViews"

None of these work. Some JS solutions KIND OF worked, but in a very glitchy way (shaking, flicker, etc.).

Any ideas are much appreciated!!

Aucun commentaire:

Enregistrer un commentaire