html - overflow-x doesn't work on Safari after rotation -
i building site need div horizontal scrollable when overflown if content bigger screen. okay, easy - , works on browser doesnt work on safari:
scenario: load page in potrait on ipad or iphone. content in scrollable div bigger screen. scroll works fine. rotate screen landscape , content smaller screen , therefore there no scrollbar. rotate potrait, scrollbar appears, scroll doesn't work. if refresh page scroll works again.
duplication of issue: scenario can duplicated fiddle: http://jsfiddle.net/v7wvbupd/2/
. if go fiddle android product works each rotation. if same apple product encounter bug.
the scroll - rotations - works fine on other mobile browsers safari.
i have been trying out several things other posts , other sites no success.
what tried , didn't work:
- setting postion of body relativ.
- adding following:
html, body {overflow-x: hidden;}
. - use:
-webkit-overflow-scrolling:touch;
on scrollable div. - adding
!important
-webkit-overflow-scrolling:touch;
,overflow-x: auto
keep being overritten when rotatet.
i have been looking js fixes adding timeout on attribute still no results:
<script> $("[scrollable]").css("-webkit-overflow-scrolling", "auto"); window.settimeout(function () { $("[scrollable]").css("-webkit-overflow-scrolling", "touch") }, 100); </script>
most of posts have come across issues scroll doesn't work @ all. in situation works until rotate landscape potrait.
my structure (simplified):
<html> <body> <div id="header" class="col-md-12"></div> <div class="scrollablediv"> <div id="footer" class="col-md-12"></div> </body> </html>
my current css:
html { overflow-y: scroll; height: 100%; width:100%; } body { padding-top: 10px; padding-bottom: 20px; height: 100%; width: 100%; } .scrollablediv { overflow-x: auto !important; width: 800px; overflow-y: hidden; padding-bottom: 55px; -webkit-overflow-scrolling: touch !important; } .col-md-12{ width: 100%; }
edit
my site using angularjs part of solution. tested if wrapping within js problem had nothing either. seems common problem safari only?
i had troubles safari past. simple things overflow become complicated ones.
i suggest use iscroll. definetely right solution such case. http://cubiq.org/iscroll-5
Comments
Post a Comment