JavaScriptはブラウザが上または下にスクロールすると判断します.

2856 ワード

 /***
     *       ,      
     * 
  ***/
    var Before_scollH = 0;
    $(window).on('scroll', function () {
        var After_scollH = $(window).scrollTop();
        var differH = After_scollH - Before_scollH;
        if (differH == 0) {
            return false;
        }
        var scollType = differH > 0 ? 'down' : 'up';
        Before_scollH = After_scollH;
         
        console.log("type", Before_scollH, After_scollH, scollType);
    })