Learn Infinite Scroll in JavaScript

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • How to create infinite scrolling in JavaScript. Find out how to implement an infinite scroll on a webpage like Pinterest, Facebook, Twitter, etc. I demonstrate how to solve this common front-end development challenge of creating an infinite scroll in JavaScript using attributes of the document and window objects. Created by Gregg Fine.
    🎓 New Course Available! "Scrollytelling 101":
    store.thecodec...
    📖 Download my FREE "Google Search Secrets for Developers" Cheat Sheet:
    store.thecodec...
    🗣JOIN the Code Creative Facebook group! :
    / 1612600368887577
    🔴Subscribe for more free Code Creative videos: : / @thecodecreative
    🌐 The Code Creative Official Website
    www.thecodecre...
    🎓 The Code Creative Courses
    www.thecodecre...
    ✅ Recommended related videos:
    Debouncing Explained
    • Debouncing Explained |...
    Memoization Explained
    • JavaScript Memoization...
    Sorting in JavaScript Explained
    • JavaScript Comparator ...
    ✅ For business inquiries contact me at gregg@greggfinedev.com
    ✅ Let's connect:
    Twitter - @GreggFine
    Instagram - /greggfinedev
    Facebook - /hiddentigermusic

ความคิดเห็น • 99

  • @TheCodeCreative
    @TheCodeCreative  2 ปีที่แล้ว

    🎓 New Course Available! "Scrollytelling 101": store.thecodecreative.com/scrollytelling

  • @onyinyechichukwuma689
    @onyinyechichukwuma689 หลายเดือนก่อน +1

    Simple and elegant explanation!
    Thanks. ❤

  • @prabhneetsingh13
    @prabhneetsingh13 ปีที่แล้ว +4

    This is explained so cleanly and simply... love it!

  • @TheCodeCreative
    @TheCodeCreative  2 ปีที่แล้ว

    Join "The Code Creative Community" group on Facebook: facebook.com/groups/thecodecreative

  • @TheCodeCreative
    @TheCodeCreative  2 ปีที่แล้ว

    📖 Download my FREE "Google Search Secrets for Developers" Cheat Sheet:
    store.thecodecreative.com/google-secrets-cheat-sheet

  • @jamesmyers3903
    @jamesmyers3903 ปีที่แล้ว +2

    Your a champion of teaching. I really appreciate your work!

  • @tirthjayswal9895
    @tirthjayswal9895 3 ปีที่แล้ว +2

    Finally after 3 hr I find the solution
    Thank You SO much

    • @TheCodeCreative
      @TheCodeCreative  3 ปีที่แล้ว

      Hi Tirth, glad to hear it! Feel free to subscribe if you like. I've got a bunch of new videos coming soon 👍🏻

  • @mrugendrashilvant8358
    @mrugendrashilvant8358 3 ปีที่แล้ว +1

    Found a clear and super easy implementation of Infinite Scroll after 2 days. Thanks man!

  • @amitmaurya3886
    @amitmaurya3886 4 ปีที่แล้ว +2

    Great!! I loved the way you narrated the whole stuff in an easy way....waiting for the next video....

    • @TheCodeCreative
      @TheCodeCreative  4 ปีที่แล้ว

      Thanks Amit, new videos coming each week!

  • @TheCodeCreative
    @TheCodeCreative  4 ปีที่แล้ว +1

    To subscribe to the channel: th-cam.com/channels/mOpHGj4JRWCdXhllVTZCVw.html

  • @nasreenkhalid6957
    @nasreenkhalid6957 3 ปีที่แล้ว +2

    This was one of the most easiest solution I could find..thanks so much :)

    • @TheCodeCreative
      @TheCodeCreative  3 ปีที่แล้ว

      You're welcome Nasreen, thanks for watching!

  • @Scrimm_
    @Scrimm_ ปีที่แล้ว +1

    Wow, friend suggested an api for this, but this seems so much more simple!

  • @fun_factory880
    @fun_factory880 2 ปีที่แล้ว +1

    Gem to the development society

  • @sudharshanpani585
    @sudharshanpani585 3 ปีที่แล้ว +1

    Dont stop making tutorials, very nicely explained. Thank you

  • @user-yt4ow6fc9u
    @user-yt4ow6fc9u 3 ปีที่แล้ว +1

    thank you!!! finally learned how Infinite Scroll works!!! thank you!

  • @spooder-mon7191
    @spooder-mon7191 3 ปีที่แล้ว +1

    0 dislikes, that's shows the quality of content, thanks man

  • @broken-wings391
    @broken-wings391 11 หลายเดือนก่อน +1

    The best explanation i ever got!! BEST VIDEO

  • @rajatetc
    @rajatetc 3 ปีที่แล้ว +1

    Simple and thorough. Thank you!

  • @jenkov2155
    @jenkov2155 ปีที่แล้ว +1

    This is awesome, perfect explantion. Saw before this video something on MDN was much more complicated.

  • @serhatbek6197
    @serhatbek6197 3 ปีที่แล้ว +2

    What a clean explanation, just subscribed right away! I wish you success. I'll check your other videos too. 😊🖤

  • @politicaltroll8920
    @politicaltroll8920 3 ปีที่แล้ว +1

    This was really helpful. Now all I need to do is figure out how to “unload” some of the old content that has been scrolled past so that the site doesn’t get bogged down.

  • @oneblackpanda
    @oneblackpanda 2 ปีที่แล้ว +1

    crystal clear, thank you sir.

  • @LoreEatKids
    @LoreEatKids 2 ปีที่แล้ว +1

    perfect video!

  • @krasimirkanov1783
    @krasimirkanov1783 ปีที่แล้ว +1

    Amazing tutorial! Very Simple Easy And Informative! Keep up the good work!

  • @yashsolanki069
    @yashsolanki069 2 ปีที่แล้ว +1

    that was really amazing explanation on scroll!!
    thanks a lot!🙌

    • @TheCodeCreative
      @TheCodeCreative  2 ปีที่แล้ว

      Glad you enjoyed it! If you want more videos on scrolling, here's a playlist for you: th-cam.com/play/PLMPgoZdlPumenunSVF3n9Z4Uil13vcH5o.html

    • @yashsolanki069
      @yashsolanki069 2 ปีที่แล้ว +1

      @@TheCodeCreative that's really amazing! Thanks alot ser!
      your teaching style is really what makes the difference and i loved it.

    • @TheCodeCreative
      @TheCodeCreative  2 ปีที่แล้ว

      @@yashsolanki069 👍🏻👍🏻👍🏻

  • @bhuku1250
    @bhuku1250 2 ปีที่แล้ว +1

    Your tutorial is just amazing bro 😍

  • @ratneshmether8585
    @ratneshmether8585 3 ปีที่แล้ว +1

    Perfect! Keep going sir.

  • @sw1tch4lb
    @sw1tch4lb 4 ปีที่แล้ว +1

    Excellent job!

  • @relievestress557
    @relievestress557 3 ปีที่แล้ว +1

    Great explanation

  • @QuohatLauncher
    @QuohatLauncher 3 ปีที่แล้ว +1

    thank you

  • @christian-schubert
    @christian-schubert 3 ปีที่แล้ว +1

    Found your channel yesterday, watched through a couple of your videos and already subscribed. It's an absolute gem and criminally underrated!
    However, for lazy loading images, I'd suggest using the Intersection Observer API instead of a Scroll-EventListener.
    Whereas the latter is called infinitely whenever the page is being scrolled, an Intersection Observer is only ever called once whenever a certain element is intersected (and can also be disconnected when no longer needed). I think you used to need a polyfill for Safari browsers, however, according to caniuse, the API is meanwhile supported.

  • @prashantvarshney8196
    @prashantvarshney8196 2 ปีที่แล้ว +1

    Great Work !! Just curious to know which font you are using?

    • @TheCodeCreative
      @TheCodeCreative  2 ปีที่แล้ว +1

      Thanks Prashant! It's called Fira Code.

  • @PIYUSH-lz1zq
    @PIYUSH-lz1zq 2 ปีที่แล้ว +1

    Can you make video real world questions like comments system,advance filter ,folder structure etc please... these were asked in interviews

  • @skygrace4300
    @skygrace4300 3 ปีที่แล้ว +1

    Hello the creative code,
    Very cool tutorial.
    May you please make an other tuto using MySQL and PHP ?

  • @prashantgupta387
    @prashantgupta387 2 ปีที่แล้ว +1

    But if we keep on adding images Innova root element then would it not create like there will be infinite images in our page and they will create the problem in the performance

    • @TheCodeCreative
      @TheCodeCreative  2 ปีที่แล้ว

      Hi Prashant, yes, of course. As I mention in the video, this demonstrates the basic concept which you can then further develop and optimize.

  • @MikeAIright
    @MikeAIright ปีที่แล้ว +1

    Can i copy the code for myself and see if it works for me? I tried using the same url for the avatar images and it doesnt work for me.

    • @TheCodeCreative
      @TheCodeCreative  ปีที่แล้ว

      Someone else had mentioned that the avatar API was no longer active unfortunately. But, hopefully, you can try the same code using a different API.

  • @skolbaek
    @skolbaek 2 ปีที่แล้ว +1

    Awsome video, really "down to the earth" explanation, I have definently subscribed :-) .. I was looking for the video you say in the video that would come at a later point, explaining how to add a loading function, but I cannot seem to find it?

    • @TheCodeCreative
      @TheCodeCreative  2 ปีที่แล้ว +1

      Hi Stig, thanks! I might not have gotten to make that video you mention yet but I'm gonna reconsider it now :-)

    • @skolbaek
      @skolbaek 2 ปีที่แล้ว +1

      @@TheCodeCreative That would be really great .. maybe perhaps combined with an example where loading JSON? :-)

    • @iamvikasrathod
      @iamvikasrathod 2 ปีที่แล้ว +1

      @@TheCodeCreative ,
      Your content is very good. But that api is no longer exist. Could you please provide new one. Thanks in advance! :)

    • @TheCodeCreative
      @TheCodeCreative  2 ปีที่แล้ว

      @@iamvikasrathod Thanks Vikas, I'll look into that!

  • @kolipakagayathri9688
    @kolipakagayathri9688 ปีที่แล้ว

    adorable avatar site ain't giving accessing...can anyone help???

  • @Ayua1
    @Ayua1 2 ปีที่แล้ว

    Hello! Please I wanted to ask if you know of any fix for infinite scroll working on mobile phone browsers. I just tested the code, but it doesn't seem to work on chrome mobile browser and is not consistent on firefox browser. I will appreciate your feedback. Thanks

  • @modeal317
    @modeal317 2 ปีที่แล้ว

    facebook and the others you mentioned doesn't actually have "infinite scroll", since they simply grab content from a database and add it into the body. The quickest way to know if an application has infinite scroll is, if you scroll to the very top and still continue to scroll upwards, new content should be added to the top of the page until you stop scrolling.

    • @modeal317
      @modeal317 2 ปีที่แล้ว

      So in essence, this video like most others don't show actual infinite scroll and is thus misleading.

  • @karina.kiraz99
    @karina.kiraz99 3 ปีที่แล้ว +1

    THANK YOU! Yeah it works but i have a problem. In the first line of JS is showing an error like (i wrote (const column = document.querySelector('.column') ) and its an error -> Parsing error: The keyword 'const' is reserved :/

    • @TheCodeCreative
      @TheCodeCreative  3 ปีที่แล้ว +1

      Are you getting this from ESLint?

    • @karina.kiraz99
      @karina.kiraz99 3 ปีที่แล้ว +1

      @@TheCodeCreative i didn't check that.. what can be a problem in ESlint? (Brackets)

    • @TheCodeCreative
      @TheCodeCreative  3 ปีที่แล้ว +1

      @@karina.kiraz99 Can you post your code on codepen? I'm not sure why you're getting the error. I don't see a problem with using the "const" keyword based on your example.

    • @karina.kiraz99
      @karina.kiraz99 3 ปีที่แล้ว +1

      @@TheCodeCreative hope you will help me :D maybe i just made some mistaces in my code, cause pictures(infinite scroll) are not showing good :/

    • @TheCodeCreative
      @TheCodeCreative  3 ปีที่แล้ว +1

      @@karina.kiraz99 Post up your code on codepen and I'll take a look

  • @skygrace8459
    @skygrace8459 3 ปีที่แล้ว +1

    Fantastique

  • @MyShoppingAdda
    @MyShoppingAdda 2 ปีที่แล้ว

    COME MY HOME AND TEACH ME ME AS I AM LORD ABHISHEK, LORD OF ENTIRE UNIVERSE

  • @hastag_developers
    @hastag_developers 5 หลายเดือนก่อน +1

    loved it

    • @TheCodeCreative
      @TheCodeCreative  5 หลายเดือนก่อน

      👍🏻👍🏻👍🏻