Issue with scrolling in iOS 5 using -webkit-overflow-scrolling

后端 未结 4 1698
北恋
北恋 2020-12-28 08:08

I have an HTML page with a fixed-height div which should be scrollable (only vertically). In iOS 5 this can be achieved using:

overflow-y: a         


        
4条回答
  •  梦谈多话
    2020-12-28 09:00

    I have found a hacky solution but it needs javascript...

    I stumbled upon that problem while loading scrollable nodes via ajax and appending them with js.

    I found out that resetting the -webkit-overflow-scrolling property with js saved the day

    JS CODE:

    var myDiv = $('.myDiv');
    myDiv.css('-webkit-overflow-scrolling','auto');
    function fn(){
        myDiv.css('-webkit-overflow-scrolling','touch');
    }
    setTimeout(fn,500);
    

    It really sucks that we have to call the setTimeout method but that's the only way I could think of...

    EDIT : Watch out for display:none

    Webkit overflow scrolling touch CSS bug on iPad

提交回复
热议问题