我想在ScrollSpy收到通知后载入更多数据。但我不明白如何捕获该事件并执行功能。如何使用Twitter Bootstrap ScrollSpy执行功能
5
A
回答
12
已更新 此触发器现已推入主版本。你可以在完整的文档中看到它。 http://twitter.github.com/bootstrap/javascript.html#scrollspy
在github上的工作分支有一个更新,它触发了一个激活的回调。
参考
一旦你抢激活触发器,你可以调用它像这样:
$("#nav li").on('activate', function() {
//do stuff
});
0
对于引导3,你可以做这样的(docs)
$('#myScrollspy').on('activate.bs.scrollspy', function() {
// do something…
})
0
这是自举4(测试版3):
一般而言,Scrollspy事件的使用并没有从自举3.这是在Scrollspy文档的Events部分中所述变化,activate.bs.scrollspy
事件将在滚动元素上触发 - 使用data-spy="scroll"
的滚动元素 - 每当一个新项目被Scrollspy激活时。你可以这样听:
$('[data-spy="scroll"]').on('activate.bs.scrollspy', function(event) {
console.log('activate.bs.scrollspy', event);
})
但是!
没有文档记录,在<body>
元素上使用Scrollspy时,activate.bs.scrollspy
事件仅在window
对象上可用。
因此,在这种相当常见的情况下,您可以像这样捕获Scrollspy事件:
$(window).on('activate.bs.scrollspy', function (event) {
console.log('activate.bs.scrollspy', event);
})
相关问题
- 1. 如何获取Twitter Bootstrap的Scrollspy插件与LazyLoad配合使用
- 2. 如何禁用twitter bootstrap 3中的折叠功能?
- 3. Twitter Bootstrap - 如何调用标签激活功能?
- 4. bootstrap scrollspy不工作
- 5. Scrollspy Bootstrap v3.3不起作用
- 6. Bootstrap Scrollspy不起作用
- 7. bootstrap scrollspy does not t
- 8. Bootstrap Scrollspy - 如何让下拉列表滚动到Scrollspy?
- 9. 我如何执行功能?
- 10. 如何使用twitter bootstrap创建侧栏
- 11. bootstrap scrollspy不能与jQuery插件配合使用
- 12. 如何使用bootstrap scrollspy将类添加到活动菜单项?
- 13. 如何使用Twitter Bootstrap设置Meteor-Angular?
- 14. Bootstrap Scrollspy活动选择器
- 15. 执行功能
- 16. 如何使用twitter bootstrap制作2(frame?)?
- 17. bootstrap 4 beta scrollspy不工作
- 18. 从javascript调用Bootstrap ScrollSpy不起作用
- 19. 使用Twitter Bootstrap进行Joomla模板
- 20. 使用jquery运行Twitter Bootstrap模式框
- 21. 使用Twitter的Bootstrap进行博客?
- 22. twitter bootstrap - 如何跳过一行?
- 23. 功能不执行
- 24. 功能执行IOS
- 25. 执行功能:Angular2
- 26. Bootstrap Scrollspy +分页 - 不起作用?
- 27. Bootstrap 4 Scrollspy不适用于Angular 4
- 28. 不能成功执行.exe使用powershell
- 29. 无法使用反射执行功能
- 30. 执行功能,而无需使用“让”