Smooth out css transitions in iOS without causing position:fixed elements to malfunction -


while testing website on ios device realized particular transition, used animate changing of div's background-color, looked jittery on it. @ first thought device's fault, when later tested on few other, newer devices result same.

i did research , discovered known problem, , need improve animation quality coax ios enabling hardware acceleration. this answer showed me how:

-webkit-transform: translate3d(0, 0, 0); 

adding style the div smoothed out transition. however, had unintended side-effect making elements had position: fixed stop working properly, , instead behave if had position: absolute instead.

here screenshot of page, scrolled down, viewed on ipad without style:

no style


and here screenshot of page scrolled down same amount, with style:

style


the nav is, in fact, still there. have scroll see it. no longer fixed viewport.

here demo demonstrates bug in action:

html,  body {      width:100%;      height:100%;      margin:0;      padding:0;      transform: translate3d(0, 0, 0);  }    #nav{      width:100%;      height:10%;      position:fixed;      top:0;      left:0;      background-color:red;  }    #content {      width:100%;      height:500%;  }
<!doctype html>  <html>   <body>    <nav id="nav">    </nav>    <main id="content">    </main>   </body>  </html>

the red nav should visible after scrolling down. depending on browser, may or may not work is. removing problematic -webkit-transform: translate3d(0, 0, 0); style makes work across browsers.

this 1 of several threads found confirm suspicion of not being case-specific. page style , position: fixed doesn't work properly.

so question is, how can enable hardware acceleration , @ same time have elements position: fixed function properly?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -