简体   繁体   English

即时更新DOM以适应新元素

[英]Updating DOM on the fly to fit new elements

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? 因此,您知道在Facebook上的情况如何,如果您开始向下滚动新闻源,则可以根据向下滚动的距离看到DOM实际上正在动态更新,以便它知道去检索/显示新元素吗? 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. 看起来它们首先加载足以填充2个可见屏幕或某些内容,然后向下滚动时将其翻倍,然后到一个点,它们将不再加载,并要求您加载更多。

How would I accomplish something like this? 我将如何完成这样的事情? Would this be done in Javascript? 可以用Javascript完成吗?

The search-term you are looking for is " Infinite Scroll ". 您要搜索的搜索词是“ Infinite Scroll ”。 There's lots of ways to achieve this, including a jQuery plugin . 有很多方法可以实现这一点,包括jQuery插件 As jQuery is built-in to ASP.NET I would recommend that. 由于jQuery内置于ASP.NET中,因此我建议这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM