css - Use Skrollr on Mobile when HTML height is 100% -
i attempting use skrollr in website. works fine except on mobile. on mobile cannot scroll down page.
i have determined because have set both html
, body
tags have height: 100%
. if remove css mobile version works fine. although css critical main website need in there. possible have keep css , have mobile version scrolling work properly?
note: know make sections
fixed wont work in website because there static sections in website aswell.
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <style> html, body { margin: 0; padding: 0; height: 100%; width: 100%; } section { padding: 5%; height:100%; background-color: red; width: 100%; min-height: 100%; overflow: hidden; display: -ms-flexbox; display: -webkit-flex; display: flex; -ms-flex-align: center; -webkit-align-items: center; -webkit-box-align: center; align-items: center; vertical-align: middle; position: relative; } </style> </head> <body id="skrollr-body"> <section data-0="background-color: rgb(0,0,0);" data-500="background-color: rgb(0,0,255);"> <div class="container vcenter"> <h1> vcentred long long long long long long long long long text </h1> </div> </section> <section> <div class="container vcenter"> <h1> vcentred long long long long long long long long long text </h1> </div> </section> <script src="js/jquery-1.11.2.min.js"></script> <script type="text/javascript" src="js/skrollr.min.js"></script> <!--[if ie]> <script src="js/skrollr.ie.min.js"></script> <![endif]--> <script type="text/javascript"> skrollr.init({ forceheight: false, smoothscrolling: false, mobiledeceleration: 0.004 }); </script> </body> </html>
solution: t04435's answer worked. heres how fixed:
edit: spoke soon, works on android not on ios (iphone specifically).
@media screen , (max-width:767px){ html, body { height: inherit; } section { height:100vh; min-height: 100vh; } }
all need far understood set media query change html,body heigth:100% in mobiles
@media screen , (max-width:767px){ html,body{ // might need play value see // 1 fits toe desired outcome heigth:initial; } }
please check @media , can right values 1 above example of need do
hope helps t04435
Comments
Post a Comment