简体   繁体   中英

safari mobile scroll lost when height is resized

I have an iframe in my website page. When i view it on safari mobile, if the height of the iframe content is resized (as an example, I click on a button that add some text at the end of the iframe content), the scrools is lost and the page is on the top again.

I checked all resize events and all event handlers in the page, but they are executed after scroll is lost. I checked all setintervall too, but they are not the cause.

This bug occurs only in safari mobile and chrome ios, not android nor any desktop browser.

Finally I solved the problem with this code css (I already tried -webkit-overflow-scrolling : touch !important; but it was not enough, I had to add overflow :

html,body{
    -webkit-overflow-scrolling : touch !important;
    overflow: auto !important;
    height: 100% !important;
}

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