How to detect horizontal scrolling in jQuery?

前端 未结 4 475
时光说笑
时光说笑 2020-12-01 07:53

How do I detect horizontal scrolling with jQuery?

This will get all scrolls:

$(window).scroll(function () {
    alert(\'in\');
});

4条回答
  •  遥遥无期
    2020-12-01 08:22

    window.onresize = function() { 
        if ( $("div").outerWidth() < $("div").get(0).scrollWidth ) {
            console.log("foo bar scrollbar");
        } else {
            console.log(" no scrolling ");
        }
    };
    

提交回复
热议问题