知道垂直滚动条何时击中div中的滚动底部

时间:2011-09-12 05:22:15

标签: jquery html scroll

我使用了以下代码,但它无效:

$("#divID").scroll(function(){
        if  ($("#divID").scrollTop() == $("#divID").height() - $("#divID").offset().top){
           alert(1);
        }
    });

divID是div的ID。

1 个答案:

答案 0 :(得分:2)

$("#divID").scroll(function(){
    if($(this)[0].scrollHeight - $(this).scrollTop() <= $(this).outerHeight())
    {
        alert(1);
    }
});

演示:http://jsfiddle.net/AlienWebguy/DgYcY/