简体   繁体   中英

Scrollable iFrame with position:sticky element in iOS

I want to create an scrollable iFrame with a position:sticky element inside, that also works on iOS.

iOS does not respect the iFrames height:340px setting, a workaround to still make it scrolling is a container div with overflow-y:auto;-webkit-overflow-scrolling: touch; (see Iframe scrolling iOS 8 ).

But when only the outside div is scrolling the position:sticky is not working. Is there any other solution to making the iFrame scrollable?

See here on web browser vs. iOS: https://codepen.io/arichter83/project/full/ZWGEaL

Okay, I found the solution - wrapping all iFrame content makes the div container obsolete:

#wrap {
    position: fixed;
    top: 0;
    right:0;
    bottom:0;
    left: 0;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
}

https://github.com/PierBover/ios-iframe-fix

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