Javascript 航点(或替代方案)
我尝试使用 Waypoints 库在我们滚动到 div 末尾时触发事件(按顺序实现类似“无限滚动”的功能)。我查看了这个示例,但如果我使用自定义可滚动“div”,它显然不起作用,它仅适用于窗口滚动。这是我的小提琴: http://jsfiddle.net/qa68m10n/6/
var waypoint = new Waypoint({
element: document.getElementById('waypoint'),
handler: function(direction) {
console.log('waypoint')
},
offset: 'bottom-in-view'
})
我对吗?还有其他选择吗?
I tryied to use the Waypoints library to fire an event when we scroll to the end of a div (in order to implement an "infinite scolling"-like functionality). I looked at this example but it apparently doesn't work if I use a custom scrollable 'div', it only works for the window scrolling. Here my fiddle: http://jsfiddle.net/qa68m10n/6/
var waypoint = new Waypoint({
element: document.getElementById('waypoint'),
handler: function(direction) {
console.log('waypoint')
},
offset: 'bottom-in-view'
})
Am I right? Is there an alternative?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过将上下文选项设置为可滚动元素,可以对路点执行此操作。
http://imakewebthings.com/waypoints/api/context-option/
This is possible to do with Waypoints by setting the context option to the scrollable element.
http://imakewebthings.com/waypoints/api/context-option/