←back to thread

1901 points l2silver | 1 comments | | HN request time: 0s | source

Maybe you've created your own AR program for wearables that shows the definition of a word when you highlight it IRL, or you've built a personal calendar app for your family to display on a monitor in the kitchen. Whatever it is, I'd love to hear it.
Show context
hohg ◴[] No.35746914[source]
@dang regarding pagination

    // Get the anchor tag element
    const anchorTag = document.querySelector('.morelink');

    // Add a scroll event listener to the window object
    window.addEventListener('scroll', () => {
      // Check if the user has scrolled to the bottom of the page
      if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
        // Fetch the content from the URL stored in the anchor tag's href attribute
        const xhr = new XMLHttpRequest();
        xhr.open('GET', anchorTag.href, true);
        xhr.onload = () => {
          // Append the fetched content to the page
          const div = document.createElement('div');
          div.innerHTML = xhr.responseText;
          document.body.appendChild(div);
        };
        xhr.send();
      }
    });
replies(3): >>35749160 #>>35758742 #>>35759338 #
davesque ◴[] No.35758742[source]
Some people appreciate being able to choose whether or not to continue browsing. Infinite scroll is not objectively better.
replies(1): >>35888154 #
1. squintychino ◴[] No.35888154[source]
Lots of websites have the option to toggle pagination on/off for those that do find it objectively better.