【发布时间】:2015-09-10 15:53:19
【问题描述】:
我发现这个答案在这里很有帮助..
Jquery infinite scroll - with div not scrollbar of body
但现在我希望能够将该值偏移 100 像素,这样您就不必在脚本运行之前到达 div 的底部。
最初我知道我是否这样做......
$('#content').scroll ->
if $(this).scrollTop() + $(this).outerHeight() >= ($(this)[0].scrollHeight - 100)
console.log 'reached the bottom'
它会起作用,但每次数字大于等式的另一边时它也会触发,但我显然不想尝试在每次脚本等于 true 时触发 ajax 脚本。
我怎样才能让这个偏移量起作用,但不知何故只触发一次?
将其设置为 equal 不起作用,因为 scrollTop() 不会给我每个数字,如果您滚动特别快,有时它会跳过数字。
【问题讨论】:
标签: javascript jquery scroll infinite-scroll infinite