Search code examples
htmlcssscrollmobile-website

how to disable scrolling on background divs in mobile web application


in mobile web application I'd often use modals.

Some modals can expand sizes and thus were made scrollable.

How can I enable higher z-indexed modal to be scrollable and set background div not to scroll?

b/c whenever I scroll with two fingers on the current modal, sometimes background scroll, sometimes foreground scrolls.


Solution

  • I think you can't fix background with background-attachment: fixed; you have to apply position: fixed on it and then

    You should try iScroll 4

    "iScroll finally received a complete rewrite. Now it’s smoother than ever and adds some new important features: pinch/zoom, pull down to refresh, snap to elements and more custom events for a higher level of hackability."

    or

    skrollr 0.6.25

    Stand-alone parallax scrolling JavaScript library for mobile (Android, iOS, etc.) and desktop in about 12k minified.

    Other Helpful link

    http://webdesigner-webdeveloper.com/weblog/fullscreen-images-for-the-ipad-ios-and-mobile-safari/

    https://github.com/louisremi/background-size-polyfill/issues/27

    http://bradfrostweb.com/blog/mobile/fixed-position/

    Hope this answer little bit helpful for you. :)