Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Prevent body scrolling when the user scrolls on fixed position div

  • This topic is empty.
Viewing 15 posts - 16 through 30 (of 36 total)
  • Author
    Posts
  • #207136
    rlnl
    Participant

    Yes, thank you. I added it. :)

    #250991
    cljaguar
    Participant

    hi, can you help me too… :)
    i’d like to prevent body scrolling or better #shadow div, when off canvas menu will appear #menu-wrap, but also i’d like to scroll #menu-wrap because there is a lot of sub menu. thanks

    i think the problem is that,:
    http://www.civico52.com
    i have a problem on iphone, when i’ll open a sub-menu, i can’t scroll it, because scroll the body on the bottom, i have to close and re-open te menu to fix it
    thanks

    #250994
    Beverleyh
    Participant

    This appears to work. Apply the same logic to your own website http://fofwebdesign.co.uk/template/_testing/test/fixed-menu-scroll.htm

    #251038
    cljaguar
    Participant

    wow! thanks!!!
    right now i’d like to hide scroll bar “in firefox”, is it possible?
    i made this for use it only on small display:
    .zacan-scrolling { position:fixed; width:300px; height:100%; overflow:hidden }
    .za-icon-list { list-style-type:none; height:100%; overflow:auto; -webkit-overflow-scrolling:touch; margin:0 }
    ::-webkit-scrollbar { display: none; }

    #251039
    Beverleyh
    Participant

    As far as I’m aware, there is no Firefox equivalent for hiding scrollbars with CSS like you can in Chrome. I don’t know what scrollbars you’re referring to though.

    #251040
    Shikkediel
    Participant

    I was wondering, @beverleyh, does that syntax trigger momentum scrolling? Still not having a touch device that supports nested overflowing elements (old Android), I can’t test it myself but I read on one of Chris’ pages that inertia can only be activated when the overflow is set to scroll (which isn’t handy at all because it creates a persistent scrollbar)…

    #251043
    Beverleyh
    Participant

    The momentum scrolling is present in this case even with overflow:auto; Maybe something changed in later iOS?

    #251044
    Shikkediel
    Participant

    Okay, thanks. I’ll try to get to the bottom of that. Here’s the article I was referring too by the way, notice the comment:

    momentum-scrolling-on-ios

    Edit – here’s a clue I hadn’t noticed before.

    #251045
    Beverleyh
    Participant

    Thanks for the link. Some of the comments about iPad seem a bit discouraging but I’ll check there once I get home (just finishing up my visit at pop’s house – currently on mobile).

    #251048
    Shikkediel
    Participant

    Yeah, not sure what allround approach to take with this. Seems quite impossible to test all actual versions of iOS (which apparently has the most issues). From threads I’ve recently superficially come across, there also seems to be a bug in iOS9 where it completely disables scrolling. Any feedback on this would be much appreciated. Bit of in the dark without any Apple-ish device myself.

    #251050
    Beverleyh
    Participant

    Yep – the momentum scroll works fine with overflow:auto; on iPad mini. Will check on an old iPad 1 at the office tomorrow.

    #251052
    Shikkediel
    Participant

    Thanks, could you then maybe add what version iOS the devices are runnning? So far I’m concluding scroll would only be necessary for iOS5 and Android 3.0 (below that no overflow support on nested elements).

    Might have saved me a bit of trouble adding scrollbars classes with JS…

    #251378
    Shikkediel
    Participant

    old iPad 1

    Any chance they’re selling one at a reasonable price? :-D
    It, or an iPod touch 3G would be suitable devices for backward testing. Both being limited to iOS5. Bearhead shared a link that provided some good insight. I suspect overflow: auto might not trigger overflow-scrolling on these older devices. But scrolling in itself should still be possible, so I guess there would be no need for overflow: scroll just to support inertia on the older OS.

    https://david-smith.org/iosversionstats/

    bug in iOS9 where it completely disables scrolling

    That was iOS8 apparently and only under certain circumstances (parent with 3d transform).

    #254294
    nbrylev
    Participant

    Does anybody faced with the same problem as topic author (https://www.youtube.com/watch?v=9h_fjEDDwlc) but with native scrolls?

    #254321
    alfrex92
    Participant

    Shikkediel I appreciate a lot that you answer this question.

    Thanks to your code, I was able to fix it!

    let fixed = document.getElementById(‘navbarhp’);
    fixed.addEventListener(‘touchmove’, function (e) {

        e.preventDefault();
    
      }, false); 
    

    Before watching your post, I spend around 3 hours trying to fix it.

    Best regards from Tokyo.

Viewing 15 posts - 16 through 30 (of 36 total)
  • The forum ‘CSS’ is closed to new topics and replies.