Mobile web page sliding stutter problem?

sample code:
< div class= "box" >

   <div class="header"></div>
   <div></div>
   <div></div>
   <div></div>
   ...

< / div >

as in the above code, box is a fixed height, and the content scrolls automatically when the content exceeds the box height (overflow-y: auto;);
when the box content scrolls at a certain height, the header is fixed (position: "fixed";)

this effect is very stuttered when sliding on iOS phones. After setting the-webkit-overflow-scrolling: touch; attribute, the page slides smoothly, but there is an exception when the header element scrolls, and the header scrolls along with the content. Only when the page stops scrolling, the header will be fixed.

ask all the heroes who have encountered similar problems, but also hope for advice! Thank you!

Feb.28,2021

fixed element is placed outside the scrolling container


when overflow-y: auto; is added, the ios page will cause stutter and slide, but the js response will not be delayed.
after adding -webkit-overflow-scrolling: touch; , the ios page slides with inertia, and releasing the finger will continue to slide, but the js will not respond from the release of the finger to the scrolling stop, and will respond when it stops.


the key here is that header will top:0 after the box reaches a certain height.
I use JS to control the state change of header:
1. Monitor body.scroll
2. Get the distance from the header to the top of the page offsetTop
3. When the scrolling height of scroll is greater than offsetTop, add fixtop style (position: fixed;top:0;) to header


The

problem is basically solved, and the structure of the sample code remains the same. The height of the page is set to the height of the phone screen, and the settings of overflow-y: auto; and-webkit-overflow-scrolling: touch; are removed. Listen to the scrolling event of the window to determine the slide and set the header element hover.

but there is a slight problem. When you open the page in iOS Mobile QQ, the header element still scrolls with the page as a whole. Open the web page in Wechat and safari, and the page effect is normal.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48897-44cb8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48897-44cb8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?