Mini Program rolling problem

clipboard.png

when the navigation part pointed by the red arrow scrolls to the top, it is fixed at the top, and when the scrolling event is simulated on the phone with onpagescroll implementation and scroll binding, it will not be executed until the sliding is complete! Do you have any good solutions?

Oct.22,2021

set the qualification when the menu bar is less than the current height of the menu bar, the menu bar displays normally. When it is greater than or equal to this height, add class:fixed to change the position:fixed, of the menu bar and then adjust the position of the item

<view class="ccc {{menuFixed ? 'fixed': ''}}" id="affix"></view>
.fixed {
position:fixed;
top:0;
left:0;

}
onPageScroll: function(ev) {
    var that = this;
    var a = ev.scrollTop; //
    if ( a < 400) {
      that.setData({
        menuFixed: false,
      })
    }
    
    if (a >= 400) {
      that.setData({
        menuFixed: true,
      })
    }
    //scrollTop
    setTimeout(function() {
      that.setData({
        scrollTop: ev.scrollTop
      })
    }, 0)
  },

you don't have a nested vertical < scroll-view > outside. Use wx.createSelectorQuery to get the distance from the top of the navigation section. When the distance is less than 0, it shows the navigation fixed at the top, and > 0 hides it. Put it in onPageScroll


because onPageScroll won't trigger in real time.
you can put the content in scroll-view < /

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-1e55c69-45361.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-1e55c69-45361.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?