Javascript 我如何实现这两个航路点-无限实时滚动和粘性标题?
我使用2个航路点来实现Javascript 我如何实现这两个航路点-无限实时滚动和粘性标题?,javascript,html,sticky-footer,sticky,Javascript,Html,Sticky Footer,Sticky,我使用2个航路点来实现 1. a sticky header (http://imakewebthings.com/jquery-waypoints/sticky-elements/) 2. An infinite live scroll (http://imakewebthings.com/jquery-waypoints/infinite-scroll/) 标题起作用。但一旦实时滚动被触发,粘性标题就会回到原来的位置,底部的“顶部”按钮也会消失。尽管如此,Live scroll仍能继续工作
1. a sticky header (http://imakewebthings.com/jquery-waypoints/sticky-elements/)
2. An infinite live scroll (http://imakewebthings.com/jquery-waypoints/infinite-scroll/)
标题起作用。但一旦实时滚动被触发,粘性标题就会回到原来的位置,底部的“顶部”按钮也会消失。尽管如此,Live scroll仍能继续工作
当实时滚动启动时,我尝试再次调用stickyHeader函数。但这没有帮助。
我的stickyHeader函数如下所示
var stickyHeader = function() {
$('.top').addClass('hidden');
$('body').waypoint(function(event, direction) {
$('.top').toggleClass('hidden', direction === "up");
}, {
offset: '-100%'
}).find('#stickyHeaderText').waypoint(function(event, direction) {
$(this).parent().toggleClass('sticky', direction === "down");
event.stopPropagation();
});
};
更新:
无限卷轴
var opts = {
offset: '100%'
};
var $footer = $('#footerDivId');
$footer.waypoint(function(event, direction) {
$footer.waypoint('remove');
ftr.remove();
// get more data
$footer.waypoint(opts);
}, opts);
stickyHeader();
标题应该在摘要中描述你的问题