Invalid mobile window.onscroll

<script>
    

    
    var stickyEl = document.querySelector(".pannle-label");
    
    
    function fixed() {
        var u = navigator.userAgent;
        var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; 
        var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //
        if(isAndroid) {
                console.log("isAndroid")
                window.onscroll = function() {
                console.log(2222);
                var scrollT = document.documentElement.scrollTop||document.body.scrollTop;                
                if (scrollT > 160) {
                    $(stickyEl).addClass("fixed-top");
                }else {
                    $(stickyEl).removeClass("fixed-top");
                }
                };
                
        }else if(isiOS) {
            console.log("isiOS");
            $(stickyEl).addClass("sticky");
            
        }
    }
    fixed();

        
    
    </script>

as shown in the code above, there are effects on ios, but if there are problems on Android, let me make a list of questions and take a look at

  1. the console didn"t output 2222 when I was scrolling
  2. I also see that there seems to be a problem with overflow with css, but I don"t know exactly
  3. css is it possible that the display:none; of the scroll bar is this problem

solve!

Mar.30,2021

I can use Chrome to simulate ios and Android devices. Android devices can print isAndroid and 2222 , ios print isIOS , I directly use < div style= "width: auto; height: 7000px;" class= "panel-label" > < / div >


looks like an attractive menu effect
guess is that the browser kernel optimizes the action while scrolling, causing the onscroll to be suspended during scrolling.

ps:
this code, if iOS executes the Android part, there seems to be a problem.
this computer side cannot be simulated by chrome.
you can see that JD.com and Taobao on mobile phones all use this effect. If you execute it in their client, you will get the same result as their effect

.

General solution: this layout is not used (2333) because of compatibility issues. Position:sticky Android in the
CSS attribute can also be used, but even with the-webkit prefix, some browser kernels do not support
or block the browser's default behavior under the onscroll method. Use a tool like js, like iscroll instead, but in this case, you need to implement the scrolling effect yourself, and the performance will be much worse.

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