【发布时间】:2015-10-13 03:48:37
【问题描述】:
有没有办法设置一个html元素数组。比如Section_1、Section_2 和Section_3 在所述数组中。当用户向下滚动页面时,并且仅在向下滚动时,是否可以检查用户是否滚动了该数组中指定的部分?有点像……
var readerLocation = 150;
var content = ['block_1', 'block_2', 'block_3'];
bottom = $(window).height() + $(window).scrollTop();
height = $(document).height();
// If user starts to scroll send an event
if (bottom > readerLocation) {
console.log('started reading');
var i = 0;
for (block in content) {
console.log(content[i]);
//check if scrolled past element in array here()
i++;
}
}
【问题讨论】:
-
你的 readerLocation 的目的是什么?
标签: javascript jquery html arrays scroll