How to Scroll Horizontally in React JS - Styled With Tailwind CSS - Javascript

Поделиться
HTML-код
  • Опубликовано: 27 сен 2024
  • In this video, I will show you how to scroll horizontally in React JS styled with Tailwind CSS. Horizontal scrolling has become quite popular with mobile viewing and companies such as Netflix , Hulu, & Prime so I decided to give one a try. You can easily switch the Tailwind out for plain CSS. No React methods were used, only javascript so you can use this in any javascript project. Thank you for watching.
    ZeroTo Mastery:
    - Master React JS Course - bit.ly/Learn-R...
    - Complete Web Developer in 2023 - bit.ly/Complet...
    Coding Challenges!
    bit.ly/Code-Ch...
    Github Repo
    github.com/fir...
    Tailwind Scrollbar Hide Package
    www.npmjs.com/...
    🔥 Connect with me on IG 🔥
    / fireclint
    ☕ Support the channel ☕
    www.buymeacoff...
    🔥 My Coding Equipment 🔥
    Logitech MX Wireless Keyboard - amzn.to/3xKPFiN
    Logitech MX Master 2S Wireless Mouse - amzn.to/3O5WmRD
    SAMSUNG 49-Inch Gaming Monitor - amzn.to/3mvUy8M
    Shure MV7 USB Podcast Microphone - amzn.to/3O00nqG
    Mic Boom Arm - amzn.to/3NHn6YU
    Monitor Desk Light Bar - amzn.to/3xzKlyj

Комментарии • 71

  • @mardiyaz4287
    @mardiyaz4287 Год назад +1

    Thanks for this explanation. Clear and precise. Made me also realize tailwind would be ugly and annoying to use in projects. Extensive lines of styling all over the place makes everything look chaotic

  • @anshXR
    @anshXR 2 года назад +3

    Exactly what I've been looking for! Thanks man ❤

  • @alexdin1565
    @alexdin1565 7 месяцев назад +1

    short easy at the point and perfect that what can i say about this video thanks

  • @JJ-ot3ps
    @JJ-ot3ps 2 года назад

    great video! been looking for this for a while!

  • @mohanadoo
    @mohanadoo 2 года назад +1

    Thanks for sharing this was very useful and easy to implement and you explain the steps very well 👍

  • @soakedso334
    @soakedso334 Год назад +1

    I LIKE YOU CUZ YOU GOT THAT SOMETHING THAT I NEED IN MY LIFE SO GIVE IT TO ME!!!

  • @cristiannass3945
    @cristiannass3945 10 месяцев назад

    thank you for the tutorial video,
    How do we disable buttons when we are at the first element and last element on the screen?

  • @PraveenMaurya-no6nf
    @PraveenMaurya-no6nf 6 месяцев назад

    i want that. Thanks. Can we do the same with tailwind css in more easy way

  • @fatimaiqra2169
    @fatimaiqra2169 2 месяца назад +1

    thanks a lot!

  • @notagant47
    @notagant47 6 месяцев назад

    I have followed all your code and it's still not working, is it because I use typescript and and Next js ? the javascript is not running smooth at all only jumping and jumping when I scroll.

  • @rayusaki88
    @rayusaki88 2 года назад

    Very helpful! Thanks man 🙏🏻🙏🏻

  • @studyafa7159
    @studyafa7159 11 месяцев назад

    greately explaine brother......

  • @mka70701
    @mka70701 10 месяцев назад

    please tell me how to add infinity autoplay slide

  • @andreasiano5953
    @andreasiano5953 10 месяцев назад

    What if i want to write something below the image? I noticed that if i add a h1 tag after the img tag the layout breaks.

  • @amirnejat5215
    @amirnejat5215 Год назад

    Amazing and helpful ty😭

  • @WilliamMusemwa
    @WilliamMusemwa Год назад

    Hi boss, I implemented the code but in my browser it showing uncaught runtime error
    cannot read properties of null (reading '''scrollLeft'') can you help

  • @DevIsrael
    @DevIsrael 5 месяцев назад

    thanks man, kudos to you

  • @raulbtmonteiro
    @raulbtmonteiro 2 года назад

    Very usefull! Thanks for sharing

  • @sajjadhoviegar5950
    @sajjadhoviegar5950 Год назад

    Is this menu scroll-able with touch screens? I mean is it possible to swipe left and right in mobile devices without clicking the icon buttons?

  • @ngc918
    @ngc918 Год назад +1

    Hey there. I implemented this into my portfolio after watching your portfolio video. I love how it came out! However, for some reason my image gallery goes over my navbar when I scroll down. Any solution for that?

    • @codecommerce
      @codecommerce  Год назад

      Awesome! Check the positioning & z-index in CSS :)

  • @rebazjabar7660
    @rebazjabar7660 2 года назад

    that is what i wanted thanks alot

  • @buivancong8967
    @buivancong8967 11 месяцев назад +1

    not reponsive ?

  • @andersonsimeon4172
    @andersonsimeon4172 Год назад

    Thank you very much

  • @Hoid1014
    @Hoid1014 6 месяцев назад

    God

  • @RudraStorm34
    @RudraStorm34 Год назад

    How can we scroll on touching the items?

  • @safiullah7184
    @safiullah7184 2 года назад

    Appreciate your efforts man
    Everything sounds good excpet getelementbyid. Dude you are manipulating the DOM directly which we should not do in React JS

  • @ismailk7021
    @ismailk7021 2 года назад

    so I used the scroll function exactly like you showed in the video, but its not working..
    I am using nextjs with typescript, but here is the code:
    const slideLeft = () => {
    let slider: HTMLElement = document.getElementById('slider')!
    slider.scrollLeft = slider.scrollLeft - 500
    }
    const slideRight = () => {
    let slider: HTMLElement = document.getElementById('slider')!
    slider.scrollLeft = slider.scrollLeft + 500
    }

    • @daotieesn
      @daotieesn Год назад

      U ARE Fix this ? I have the same issue

    • @ismailk7021
      @ismailk7021 Год назад

      @@daotieesn Yeah you need to wrap a div around the div that has the slide function.

  • @snorfold
    @snorfold 2 года назад

    thats not realy optimised.. 2 function for that please only 1 is needed... and why getElementByid please use useRef with hooks

    • @kamaboko1
      @kamaboko1 2 года назад +2

      Make your own tutorial and post it.

    • @usmanrangrez-cd7zj
      @usmanrangrez-cd7zj Год назад +1

      const sliderRef = useRef(null);
      //use this is your element
      ref={sliderRef}
      const slideLeft = () => {
      sliderRef.current.scrollLeft -= 500;
      };
      const slideRight = () => {
      sliderRef.current.scrollLeft += 500;
      };

  • @unboxinggadgets4105
    @unboxinggadgets4105 2 года назад

    Pls sir use bootstrap css, in india developer don't use tailwind css

    • @codecommerce
      @codecommerce  2 года назад +3

      Oh no I hate using bootstrap! haha. I'll try and use it a least once in a video :)

  • @vasilemidrigan50
    @vasilemidrigan50 Год назад

    Can I do that without Tailwind?

  • @pinguk9130
    @pinguk9130 2 года назад

    I was looking for the same can we add videos instead of images ? Can please make a video on that how can we add videos in this slider?

  • @andreasiano5953
    @andreasiano5953 10 месяцев назад

    I tried to add a div that wrap the img tag but again the layout breaks.

  • @giovannaramos3239
    @giovannaramos3239 Год назад

    can scrollLeft be modified ?

  • @mohamedyoussef8835
    @mohamedyoussef8835 2 года назад

    Awesome video +++++++++++++++++ 😃

  • @ittarek5870
    @ittarek5870 Год назад

    nice video. thank you

  • @cezarylachut4428
    @cezarylachut4428 2 года назад

    hi great channel ; - ) i have rect+vite-tailwind , but there is a problem with local img not showing up, even after import, when I import from http it works

  • @sushantw834
    @sushantw834 Год назад

    Thank you.

  • @mounis
    @mounis 2 года назад

    Isn't there any other way to achieve this, I mean without using a querySelector? Shouldn't we avoid using querySelector in React? Looks somewhat hacky to me. However, I still appreciate what you've done. Thanks

    • @codecommerce
      @codecommerce  2 года назад

      Mounis - you are correct, a bit hacky. Perhaps I’ll do a follow up video with useRef

    • @mounis
      @mounis 2 года назад

      @@codecommerce that'll be great

  • @Badnercalabrese
    @Badnercalabrese 2 года назад

    Loving the new branding ! Code commerce ftw.
    Really appreciate your content man.

    • @codecommerce
      @codecommerce  2 года назад

      Appreciate it! I was thinking of changing the name of the channel to my full name - not sure yet.

  • @Yukthiisuranga
    @Yukthiisuranga Год назад

    thank you

  • @kingjoo8309
    @kingjoo8309 2 года назад

    brother it's helpful I hope for you success

  • @muratti32
    @muratti32 2 года назад

    thank you. very helpfull

  • @ParaViciosos
    @ParaViciosos Год назад

    muchas gracias ! me sirvio de mucho

  • @pinguk9130
    @pinguk9130 2 года назад

    Sir Can you please try this with videos??

    • @codecommerce
      @codecommerce  2 года назад +1

      Good idea pingu

    • @pinguk9130
      @pinguk9130 2 года назад

      @@codecommerce I have tried this with videos with tailwind css and it worked.😊

    • @pinguk9130
      @pinguk9130 2 года назад

      @@codecommerce sir one more thing can we connect multiple pages in reactjs. And also full website with frontend and backend