动态更新 DOM 以适应新元素
那么您知道在 Facebook 上如何,如果您开始向下滚动新闻源,您可以看到 DOM 实际上根据您向下滚动的距离实时更新,以便它知道去检索/显示新元素?我假设它这样做是因为他们不想在每次加载主页时为每个用户加载大量记录。
看起来他们一开始加载的内容足以填满 2 个可见屏幕或其他东西,然后当你向下滚动时,它们会加倍,然后到了他们不会再加载的地步,它会要求你加载更多。
我将如何完成这样的事情?这可以用 JavaScript 完成吗?
So you know how on Facebook, if you start scrolling down through your news feed, you can see the DOM actually update on the fly based on how far you have scrolled down so it knows to go and retrieve/display new elements? I'm assuming it does this because they don't want to load the insane amount of records for each user every-time they load up their main page.
Looks like they load enough to fill maybe 2 visible screens or something at first, and then as you scroll down they double that, and then it comes to a point where they won't load any more and it asks you to load more.
How would I accomplish something like this? Would this be done in Javascript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要查找的搜索词是“无限滚动”。有很多方法可以实现这一点,包括 jQuery 插件。由于 jQuery 是内置于 ASP.NET 中的,所以我建议这样做。
The search-term you are looking for is "Infinite Scroll". There's lots of ways to achieve this, including a jQuery plugin. As jQuery is built-in to ASP.NET I would recommend that.