屏幕滑动与滚动条事件进行绑定

$(window).scroll(function() {
    // When scroll at bottom, invoked getData() function.
    if ($(window).scrollTop() + $(window).height() == $(document).height()) {
        if (trackLoad.groupNumber <= totalGroups && !trackLoad.loading) {
            trackLoad.loading = true;      // Blocks other loading data again.
            $('.animation_image').show();
            $.getData(trackLoad);
        }
    }
});

每当用户把滚动条拖到最底端时,就调用getData()方法获取数据,那么,我们需要把getData()方法和滚动条事件进行绑定,具体实现如上:

你可能感兴趣的:(屏幕滑动与滚动条事件进行绑定)