React Easy Slider with Framer Motion Tutorial

Поделиться
HTML-код
  • Опубликовано: 5 янв 2025

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

  • @oyetoladavid3128
    @oyetoladavid3128 2 года назад +42

    Congratulations ED on your engagement
    You inspired me a lot, watching your tutorials has taught me a lot made me go from zero to hero Thanks once again 👍

  • @vedantingole8711
    @vedantingole8711 2 года назад +12

    Congrats on your engagement !
    this is exactly what is going to make for my next project, this certainly saved a some of my time.🎉

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

      Actually not some some just a lot coz logics to present our ideas a sometimes costs much time

  • @skelldragon5
    @skelldragon5 2 года назад +4

    Hey Ed, im from Brazil and i'm developer here. I implemented this feature in my project and stayed very nice. Thank you so much bro. !!!!!!! You save me !!!! Very clean code. I will try implemented button for next and prev carousel. :D

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

      Conseguiu alterar quando a pessoa da um resize na tela? Aqui quebra se tiver no desktop e ir pro mobile sem fazer um reload

  • @JustPerfectDesigns
    @JustPerfectDesigns 2 года назад +13

    Congratulations Ed.
    A great programmer and a responsible man.
    Perfect combo! 🔥

  • @alexanderbuk-swienty7334
    @alexanderbuk-swienty7334 2 года назад +15

    This is great! But breaks down on resize. For those, like me, who wanted it to be responsive. Here's a somewhat hacky solution:
    - Use an id instead of ref to always have the current widths
    - Use a key to force a rerender of the outer container (the hacky bit)
    // outer container using a key
    // set the left constraint
    const handleLeftConstraint = useCallback(() => {
    const el = document.getElementById(id);
    if (el) {
    setLeftConstraint(el.scrollWidth - el.offsetWidth);
    }
    }, [id]);
    // set key and left constraint on resize
    useEffect(() => {
    const handleResize = () => {
    setContainerKey((prev) => prev + 1);
    handleLeftConstraint();
    };
    window.addEventListener("resize", handleResize);
    return () => {
    window.removeEventListener("resize", handleResize);
    };
    }, [handleLeftConstraint]);

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

    Congratz @Dev Ed!!! Best wishes for both!!

  • @NoName-yb1in
    @NoName-yb1in 2 года назад +3

    Ooo, is this a fellow Maiar & Elrond enjoyer?
    Congrats on the engagement!

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

    Congratulations on the engagement, you owe your RUclips community a wedding invitations

  • @riturajranjan2072
    @riturajranjan2072 2 года назад +9

    You tutorials on basics of html, css,js, node, react, animations have helped me a lot. Thanks for being so awesome 😊

  • @sudershansingh2839
    @sudershansingh2839 2 года назад +4

    Congratulations Guys!! 🎉❤️
    It Feels so great 💐

  • @TheOtherMattPerry
    @TheOtherMattPerry 2 года назад +8

    You can set dragConstraints to be a useRef containing the parent element instead. It will automatically measure it and use that for the constraints. Great vid and congrats!

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

      Me neither. Can you please try to explain more about this solution?

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

      is there a way we can click on the image?

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

      @@sitoshinako4553 I'm struggling with this at the moment. have you found a solution?

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

    This was quick and fancy, your personality is fire! Congrats, hope all is well!

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

    Congratulations on the engagement!! 🤗🥳

  • @DANGreen-dn6rs
    @DANGreen-dn6rs 2 года назад +1

    Congratulations to you ! You inspire me a lot on all the front-end part tips and tricks ! Best of luck for you future !

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

    Congrats on the engagement!

  • @dor.332
    @dor.332 2 года назад +1

    Congratulations Ed!!!! So happy for you

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

    Congratulations Ed on your engagement you are a very crazy developer

  • @sumanthprabhu11
    @sumanthprabhu11 2 года назад +27

    If u would do an ultimate react animation course with framer motion that would super

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

      Yes you right, I can't find a good framer motion course

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

    Congratulations on your engagement DEV ED.

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

    Congratulations Mr and Mrs future Ed. Hope you both have an amazing life together 🎉🎉🎉

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

    Awesome tutorial, also love your style of teaching. How would you make this work after resizing the window? I tried to hook it up to a resize eventListener, but it only works correctly when I'm all the way at the begining while resizing. If i'm scrolled all the way over to the right, width comes out as 0. Any idea how to implement this correctly?

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

      Also, this only works if I have a padding on the items, without it width also equals 0.

  • @aarondiaz2506
    @aarondiaz2506 Год назад +9

    Here is my version. I think is shorter, simpler and responsive. I couldn't do it without watching this video and that comment: "You can set dragConstraints to be a useRef containing the parent element instead. It will automatically measure it and use that for the constraints. Great vid and congrats!". Thank everyone involved in the React online community. Here are my 2 cents:
    import React, { useRef } from 'react'
    import {motion} from 'framer-motion'
    export const Box = () => {
    const boxRef = useRef(null)
    return (

    {
    Array.from({length: 20}).map((_, i) => (
    ))
    }

    )
    }

    • @herdina7
      @herdina7 Год назад +2

      It worked. Thanks! To whoever is following the video's code, besides removing state, useEffect and adding the carousel ref to the dragConstraints property, you just need to apply "display: flex" to the carousel element (the one with className carousel).
      I've tried solving this using a window resize event inside that useEffect. The "width" state changes as expected, but it seems dragConstraints just bugs. It doesn't use the new values and actually recalculates even the "right: 0" to some bullshit. I don't know why that happens.

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

      Thankyou, it worked for me. Anyone using display flex on "inner-coursel" and having issue try to change it to display "inline-flex"

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

      Thank you so much, it worked. I've been following the comments and getting the answers for responsiveness in bits but this is it!@@herdina7

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

    Congrats Guys!!! Stay Together Forever. God Bless You.

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

    congrats on your engagement guys ❤️

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

    Congrats on the engagement, Ed!

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

    Congratulations Ed on your engagement you are the best

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

    Congratulation on the engagement 💍
    Nice tutorial as always

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

    That's really sweet. Congrats on your engagement!!!

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

    congrats man I have been watching you since 2+ years from pakistan

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

    congrats on the engagement Ed

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

    Congratulations!!!!!

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

    Oh congratulations man!! ألف مبروك صديقي

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

    Congratulations guys best wishes for you! And yesterday is my birthday, wish me happy birthday Ed.. i'm waiting.

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

    Many many congratulations both of you for you future ...And thank you so much for providing such informative contents.

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

    Congratulations on the engagement bro! 🌞

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

    congraulation. now bless us with little ed and his development skills :)

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

    Congrats Ed.
    I really happy for you.

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

    HAPPY FOR YOU CONGRATS!!!!!

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

    wow, congratulations Ed !

  • @Ace-tl5tw
    @Ace-tl5tw 2 года назад +1

    Congratulations on your engagement brother

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

    I have never been soo early!✨ Also Congratulations and best wishes 🎉✨

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

    Congratulations guys 🎉 Best Wishes ❤️

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

    Congrats Eddy! Best wishes for you both

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

    Congrats Ed🎉

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

    Congrats, I'm really happy for you!!!

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

    WE love you dev ed give us more of these cool animations on react and CONGRATS MA DAWG!!!!!

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

    Congratulations ed!

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

    this particular video changed my perception of a whole lot of stuff!!!!!

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

    Congrats Ed :) wish you two all the best

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

    congratulations to you and you're beloved! and thanks for such great contents, wish you a great day Ed!

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

    Omg! Congratulations you guys 😍🎉

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

    eventually it all snapped into place and I started learning how to add all the effects, titles, motion text. It was pretty cool to see my

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

    Awesome! Thanks so much for this video. And congratulations to both of you 😊

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

    Congrats Ed :))

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

    Congratulations on getting engaged..❤️
    Now looking forward to Future Mrs. Dev teaching us web development 😌

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

    Congrats man ! 🎉

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

    I am so happy for u guys

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

    Lol congratulations 🎊 yall sound perfect together already 😁

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

    Congrats mate!!

  • @Shahrukhkhan-iu7yq
    @Shahrukhkhan-iu7yq Год назад

    I love your way of teaching things. Congratulations.

  • @_duongductrong
    @_duongductrong 4 месяца назад

    so helpful and easy impl slider with framer motion, thank u for your tutorial

  • @user-gd8mh3or9i
    @user-gd8mh3or9i 2 года назад

    Congrats ED on your engagment!!

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

    OMG I'M SO HAPPY FOR YOU GUYS KEEP THE GRIND UP BRO AND CONGRATULATIONS 🎊🎊🎊

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

    The useRef() doesn't work when the data loads in and the container changes in size to accommodate the new data. What can I do?

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

      useEffect(() => {
      dispatch(getMiniGame()).then(() => {
      setWidth(carousel.current.scrollWidth - carousel.current.offsetWidth);
      });
      }, []);

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

      @@taitran7822 Wtf? What is dispatch and miniGame?

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

    Haha congrats you big ol nerd! Learned quite a bit from you over the year. 👏🙌

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

    Congratulations on your engagement

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

    congrats bro🎂💐

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

    Congratulations on the engagement! all the best for the two of you.

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

    Congratulations on the engagement !

  • @V.Dragnev
    @V.Dragnev 2 года назад +1

    Congrats Ed, wish you happiness and full house with children ;)
    Project idea: build a wedding organization website ;)
    - with all thing that have to be prepared before wedding
    - guests
    - table guests
    - wedding day schedule
    and so on... ;)
    Little fun project right :)

  • @crazy-yb5fv
    @crazy-yb5fv 2 года назад +1

    #Congratulations and best wishes both of you guys💖

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

    Only the inner-carousel is draggable for me... anyone else fix this bug?

    • @Test-ql2ch
      @Test-ql2ch 2 года назад

      No, ran into the same issue were you able to figure it out?

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

      @@Test-ql2ch yeah lmk if you still need help

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

    Awesome! but there is a problem when you resize the page and drag, the dragConstraints disappear...

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

      Exactly. Have you found a solution for this issue yet?

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

      same here. did you find the solution to this?

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

      @@idan5930 In the App.js component change the useEffect hook to this:
      useEffect(() => {
      setWidth(carousel.current.scrollWidth - carousel.current.offsetWidth);
      }, [innerWidth, innerHeight]);
      That fixed it for me.

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

    congrats bro hope u stay forever toghter :)

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

    Congraats Ed and futur Ms. Ed 🥳

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

    Congratulations Ed. Way to go. ❤❤

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

    How can I deal with resize? When I resize, maximize or minimize the browser, it loses dragConstraint. I read all the comments but it didn't work as expected. Please help me.

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

    Congratulations guys 🎉

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

    Congrats! 🎉

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

    Happy engagement Ed, so happy for you. Also as usual great content.

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

    congratulations Ed !!

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

    çok güzel. tam da aradığım şeyi buldum. harikasın dostum. Türkiye den selamlar

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

    Congratulations Ed ❤❤

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

    Congratulations my man🙇‍♂️🎉❤💯🥂

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

    Congrats man. Love your content.

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

    Congratulations to both of you 🤗

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

    Congrats! Also, the dog wants royalties.

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

    I WANNA SEE IT IN SVELTE ! MORE SVEVLTEKITTTT also gz on engagement!

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

    Congratulations Ed!

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

    Thanks a lot for this tutorial !
    I've a question : Is there a way to update dragConstraints values ?
    Because I'm trying to make it responsive if user on mobile decide to turn the screen.
    // I've tried to update with a resize event listener as below
    useEffect(() => {
    setWidth(ref.current.scrollWidth - ref.current.offsetWidth);
    const handleResize = () => {
    console.log(ref.current.scrollWidth - ref.current.offsetWidth);
    setWidth(ref.current.scrollWidth - ref.current.offsetWidth);
    };
    window.addEventListener("resize", handleResize);
    return () => {
    window.removeEventListener("resize, handleResize");
    };
    }, []);
    //
    Console return correct value of width.
    Thank your for your answer !

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

    Congratulations man! You're a treasure Ed!

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

    Genuine question for those that watched the whole video (I haven't).. Why is framer being used here and why would it take 6 hours?
    Based on the beginning and end demo, it seems like this can be accomplished with a scrollable container and some styling, right? What am I missing?
    Is this just an exercise to accomplish a carousel specifically using framer drag?

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

    CONGRATULATIONS!!!

  • @ShreyaRaj-yf7fe
    @ShreyaRaj-yf7fe 2 года назад +1

    Congratulations!

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

    Tabriklayman Ed. 100tadan ortiq farzandli bo'linglar. Umid qilamanki buni tarjima qilasan.

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

    Congratulations ED 👍

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

    I have problem, my images load during I scroll, I cant load them all at the beginning...
    I tried to wait while images will load (check parameter -> img.complete), also create hook for this case, but it doesnt work.
    I tried to use Promise.all in useEffect to wait for loading.
    I tried to use onLoad for each img and it also didnt help me.
    And one more question:
    When you try to change width or height of your screen (for example in responsive design mode -> ctrl+shift+m), carousel.current.scrollWidth and carousel.current.offsetWidth do not refresh and do not recalculate new width for dragConstraints (left).
    I tried to use createRef instead useRef because createRef will always create a new ref but it didnt help...
    I tried add some dependencies inside useEffect which recalculate width for dragConstraints, create new useEffect near existed which reset carousel ref but it doesnt help...
    Can you please create new video with help?

  • @NamNguyen-oz8uj
    @NamNguyen-oz8uj 2 года назад

    Congratulations on your engagement! 🎉🌹🎉

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

    Man you really save my life on this, thanks a lot x)

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

    Congratulations Ed.👍🙏