我想用scrollTop检测父div内div的位置(例如#content)(例如.row),并将一个类应用于此.row(因为有很多div具有类行,因此必须应用div的一个类,它的底部是x个像素。
我尝试将.row应用于所有类,并且运行良好,但无法将其应用于适合if参数的潜水(.row)。
$(function(){
if ($(".row").offset().top > ($("#content").scrollTop() + $("#content").height() - 40)) {
$(this).addClass("above-popup");
}
});