Sliding on the mobile side occasionally fails, resulting in the inaccessibility of the entire website (no problem on the PC side)

/ / add sliding left and right toggle real events

    var windowHeight = $(window).height(),
    $body = $("body");
    $body.css("height", windowHeight); //
    $("body").on("touchstart", function(e) {
        e.preventDefault();
        startX = e.originalEvent.changedTouches[0].pageX,
            startY = e.originalEvent.changedTouches[0].pageY;
    });
    $("body").on("touchmove", function(e) {
        e.preventDefault();
        moveEndX = e.originalEvent.changedTouches[0].pageX,
            moveEndY = e.originalEvent.changedTouches[0].pageY,
            X = moveEndX - startX,
            Y = moveEndY - startY;

        if ( Math.abs(X) > Math.abs(Y) && X > 0 ) {
            window.location.href="/<?php echo $this->school_flag;?>/main/bk";
        }
        else if ( Math.abs(X) > Math.abs(Y) && X < 0 ) {
            window.location.href="/<?php echo $this->school_flag;?>/main/wd";
        }
    });-sharp-sharp-sharp 

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Mar.30,2021
Menu