Questions tagged [infinite-scroll]

Infinite Scrolling, also known as endless scrolling, is a technique that is widely used by websites and Web applications that host lots of content on a page where pagination would traditionally have been used. Infinite scrolling involves initially loading only one page of content. As the user scrolls down, the browser fetches another page via an AJAX request. There are several Infinite Scrolling plugins that facilitate this technique in modern browsers.

Background:

In Web 1.0 applications, it is common to see pagination used to limit the browser from displaying all of the data in a set all at once. Pagination allows a subset of the data to be displayed on the page, which reduces the memory footprint and decreases the lag-time caused by too much visible markup being displayed in the DOM.

Pagination involves "next" and "prev" links as controls in which a user uses to traverse through the data. This technique is facilitated through either full page reloads, where clicking next reloads the page with the next data subset, or it's facilitated through AJAX, where the application replaces a portion of the page with the next set of data.

Some Infinite Scrolling plugins, such as the Infinite Scrolling - A jQuery Plugin simply extend this type of pagination by hiding the "prev" and "next" hyperlinks and automating the click through process by monitoring the scrollTop position, while others do not.

Thus, for websites and web applications with an existing legacy pagination technique, a plugin that extends existing functionality may be more desirable.

Example of the Infinite Scrolling Technique:

An real-life example of the infinite scrolling technique is found here

Infinite scrolling plugins:

Below is a list of some widely known Infinite Scrolling plugins:

When should I use this tag?

You should use the [infinite-scroll] tag on questions where you know or reasonably believe through trial and error that the problem you're facing is related to an infinite scroll plugin or an infinite scroll technique.

For example, this question is asked by a user who was having problems getting the jQuery Infinite Scroll plugin to work. The error the user is seeing only appears when the plugin is loaded, which implies that the plugin is involved in the problem.

It's not helpful to tag a question with a tag that isn't specifically involved in the problem, so an example of a situation where I wouldn't use the tag would be if the Infinite Scroll plugin or technique was working great, yet I had problems making an AJAX call to the server. Additionally, the problem occurs with or without the plugin; therefore, I would not use that tag in this specific scenario.

Advanced Techniques:

The majority of the Infinite Scroll plugins that exist, in general, only offer one way scrolling functionality. In other words, as the user scrolls down, more content is added. However, in most cases, the content above the visible viewing area remains actively loaded in the DOM.

As users scroll down long enough, they may begin to experience a lag as more and more memory is consumed by the browser. With enough content, this could theoretically cause a browser crash.

Ben Nadel writes a blog post covering Bidirectional Infinite Scroll. While there is no demo, in the blog post, he includes a video that demonstrates the technique.

For Bidirectional Scroll, there exists no plug-in at this time, at least none that are easy to find. The bidirectional technique is much harder to implement than the one-way technique.

The difficulty comes not from implementing two directions per se, but instead the difficulty manifests itself when attempting to implement scrolling that loads content above the visible area, such as when the user scrolls up. When scrolling down, new content added to the page does not affect the visible viewing area. While users may see the scrollbar move, the content itself is not affected.

But when content is loaded on top, the visible scroll area shifts, and the user experiences a jarring effect. Ben Nadel's technique involves storing the scrollTop position prior to loading in new content on top, and then once the content loads, a new scrollTop is quickly calculated before the user experiences any side effects.

2222 questions
0
votes
1 answer

How can I reinitialize or destroy `infiniteajaxscroll` V3?

How can I reinitialize IAS or destroy on V3? (no jquery, I am using import InfiniteAjaxScroll from '@webcreate/infinite-ajax-scroll';) There's also no reinitialize or destroy on their doc…
ivanasetiawan
  • 879
  • 1
  • 10
  • 26
0
votes
1 answer

Infinite scroll / error with the data return from useEffect

I work on a basic infinite scroll and I've got a problem getting the data from Items. It works in my useEffect call, I console.log it, and everything is there. But then the value set to 1... why? Thanks const List = () => { const [Items,…
policy
  • 3
  • 1
0
votes
2 answers

Wordpress posts not loaded when login as non admin? (custom theme)

I am building a website that able user to posts an article using wordpress (I build my own theme). And in home page, the user will view posts by user that followed by it (like twitter timeline). I use infinite scroll based on jQuery to replace the…
0
votes
1 answer

Endless scroll function with adding same page

I would need an endless scroll function for a webpage. If the page gets scrolled to the bottom, the same page should be added without reloading the content. Here would be a beginning of the code: $(window).scroll(function() { …
Elena1a1a
  • 21
  • 5
0
votes
1 answer

Ionic 4+ paginated rest api search filter with infinite scroll

I'm using ionic 5.4.5. RestApi was created with node and express js. When I want to search, the app just looking for datas on the first page. I want the app to search for all datas.How can I do this? Our api paginated. app.get("/units", (req, res)…
ucnumara
  • 155
  • 1
  • 1
  • 11
0
votes
0 answers

Infinite scroll keeps triggering till all data fetched in Angular

Am working on a Infinite scroll for a div to show my table with data As soon as scroll happens on the div am listening it through HostListener. As mentioned below code it executes and a service is made and data gets added to the table but the…
AkRoy
  • 343
  • 4
  • 10
0
votes
0 answers

Why is this rendering slow? React

I have an api that fetches names(usernames) based on country somewhere along the lines of. /names/{countryName} and the UI has two tabs - being Australia and India. For this I'm using material ui tabs in react. Once the user clicks India it calls…
inquisitive
  • 3,738
  • 6
  • 30
  • 56
0
votes
0 answers

Pagination, instead of infinite scroll, is showing. How to make this code work?

I'm trying to implement infinite scroll using will_paginate. Given my current code, the output is that on each page, content is printed twice (...) and when I get to the bottom of the page, only regular pagination is there (no infinite scroll). When…
superbot
  • 401
  • 3
  • 19
0
votes
1 answer

How to create a gradient background on infinite scroll?

I'm trying to create an infinite scrolling page where the background is a gradient that changes according to the scroll position. I found this infinite scroll code that works with the time and date. I would like to replace it with the gradient…
tuf
  • 13
  • 2
0
votes
3 answers

ngx-infinite-scroll scrolled event won't stop firing

I implemented infinite scroll with ngx-infinite-scroll. When the user reaches the bottom of the scrollable element (with a fixed height), the event 'scrolled' will trigger and call an API to load more items into this element. The problem is, when I…
Florent Arlandis
  • 866
  • 1
  • 10
  • 29
0
votes
1 answer

How to scroll to specific element using the Infinite Scroll With Django?

When I initially load the page, It loads 10 items(1,2,3...10) and after scrolling down I am getting another 10 items(11,12,13,...20). But I need to directly scroll to the 12th element. I am using the Waypoint infinite scrolling(JQuery) and Django…
0
votes
1 answer

How to Stop Infinite Scroll After Content Is Loaded

I created an infinite scroll that generates a new set of images when it gets to the bottom of the document. I want this infinite scroll to reveal images at different heights but I want it stop after all images are loaded. Here is the codeine:…
Elizabeth
  • 157
  • 1
  • 15
0
votes
1 answer

Scraping data from a website with Infinite Scroll?

I am trying to scrape a website for titles as well as other items but for the sake of brevity, just game titles. I have tried using selenium and beautiful soup in tandem to grab the titles, but I cannot seem to get all the September releases no…
0
votes
1 answer

JAVASCRIPT execute function when user SCROLL DOWN and SCROLL TOP

This function load data from db, how to execute it when user scroll page down and scroll top