Vanilla JavaScript: horizontal Smooth Scrolling Parallax Slider

Поделиться
HTML-код
  • Опубликовано: 26 фев 2021
  • Hi guys,
    Back with another video where we will be creating a parallax slider.
    We will be using the lerp function to create out own horizontal smooth scrolling effect with JavaScript.
    Thanks for watching and please subscribe if you wish to see more videos like this.
    Conor
  • НаукаНаука

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

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

    My brother, you are so underrated. You have skill that not many developers have. Please keep making videos, I believe more people will discover you, it just takes time. Love your content bro!

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

    Thank you for your Tutorial!! I really enjoyed recreating the end result :) A mobile Version for this type of site would be sooo cool. Meaning, when you scroll on your phone it would be vertical scrolling with the same parallax effect. That would be bonkers!!!! Maybe consider this as a video idea.

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

    Thanks for the tutorial!! From Brazil 🇧🇷

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

    You are amazing! Thank you very much.

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

    Very useful. Thank you!

  • @louisventura4450
    @louisventura4450 3 года назад

    Thanks for the tutorial!

  • @austinejose1516
    @austinejose1516 3 года назад

    Thanks for the tutorial, Great Content.

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

    Thanks man!

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

    Absolutely amazing content! Could you please also make this kind of projects on react too ? Would really appreciate it!

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

    thankyou for this!

  • @BMikel
    @BMikel 3 года назад

    Appreciate your work. Thanx

  • @lawrenceardosa1730
    @lawrenceardosa1730 3 года назад

    gotta like first before watching this awesome content!

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

    Thanks, @Conor Bailey for sharing your solution. I have tried to implement this in React js but it isn't working. The part I had issues with is iterating over the directory containing the images and then displaying them. Every other aspect of the code worked but just that part of looping over the image folder. I tried using the import and map function but became a pain in the neck as everything scattered. Any solution to this?

  • @mdkhaled3226
    @mdkhaled3226 3 года назад +3

    👌 love your content , Make more video like loading screen animation, Thank you

    • @ConorBailey
      @ConorBailey  3 года назад

      Thanks dude! I’ll get some more vids like that put up. Thanks for the suggestion!

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

    AMAZING

  • @MostafaAhmed-fq9nn
    @MostafaAhmed-fq9nn Год назад

    very nice pro I love this effects thinks for teach me this !

  • @thebusta8859
    @thebusta8859 3 года назад

    THanks brotha

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

    Thank you for the tutorial!!! But why is my window addeventlistener resize not working for scroll??

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

    Thanks! Let's see how my instructor likes this example as opposed to theirs when I hand in my assignment...

  • @mimitecrazy
    @mimitecrazy 3 года назад

    Okay it's really nice but how can i do this in a smaller container, because when i scroll the images scrolls but the page also
    And i just want the images to scroll independently

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

    can you also use this with react ?

  • @ullaskunder
    @ullaskunder 3 года назад

    Our University needs your help........😁

  • @frank_t.
    @frank_t. Год назад

    how to make this effect on slider plugin - owl or slick

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

    I like the way this guy says haytchtml

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

    Thank you for your Tutorial!! Please send source code of this demo

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

    hello! the window.addEventListener('resize',init); didn't work for me, and how do i add small spaces between each images? please help

  • @Gendon-
    @Gendon- 2 года назад

    👍🏻👍🏻👍🏻👍🏻🤝🏼

  • @ahndaekyung
    @ahndaekyung 3 года назад

    Hi conor ! Big Hello from France ! A music man who loves development too ! Thank you very much for your videos really i love your way to explain and to do and your work. I need your help if it's possible because i would like to add a drag horizontal function to your slider (in vanilla js of course). Is it possible to do ? Thank you again, i'm blocked about this for a very long time ! (ps sorry for my poor english)

    • @ConorBailey
      @ConorBailey  3 года назад +1

      Hi mate. This is possible and I do cover a draggable slider effect in the following video:
      ruclips.net/video/KHGc7eZyxKY/видео.html
      I should be simple to implement the drag functionality with this Parallax slider. I'll look into this for a further video.
      Thanks bud.

    • @frank_t.
      @frank_t. Год назад

      @@ConorBailey Hi, this is a very cool effect, is it possible to do one with plugins - owl or slick?

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

    Try to use GitHub repository to ease ur subscribers from coding this after watching the video, it helps because it will ease them d stress. It’s just to download d zip and run it

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

    my images arent showing up at all ;(((((

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

    Hay Connor.
    My name is Dekdi, I am beginner front end programmer from Bali, Indonesia. I am succeeded in making one as the same as your tutorial. But when i applied to my project i got little stuck. I want to make the parallax slider work when it touch my third section not from the begining of my page, it become weird and error. Do you mind let me know which line in your code that i should change and adjust to make it work to the section that i want? Could you give me the example of the code?. I would appreciate it thanks.

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

      i am having the same issue please let us know any method available...

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

    Make a slick sliders with vanila js,

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

    can anyone plz give intiution behind lerp function

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

    can you provide the code pls

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

    Trying to place this slider further down the DOM breaks the functionality as it calculates scrollY value since the top and already substantially moves the slider much to the left by the time we reach there. Any fix?

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

      Hey. Hmm you could try getting the offsetTop property of the slider parent element and then subtract that amount from the transformation? Will be happy to take a look at a codepen if you post II here 🙂

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

      @@ConorBailey yeah I just saw a similar comment by you on the infinite image horizontal scroll video. Looks like a wonderful fix. Will try later today. But if it doesn't, i shall post a codepen here, please take a look then. :D
      You are doing a commendable job. Never stop these quality Vanilla js vids.

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

      @@ConorBailey Ok it works!
      setTransform(slider, `translateX(-${current - (sliderOffsetY - window.innerHeight * 0.7)}px)`)
      But one thing. Assume I have about 8 images, and I want the last one to come in view by the time the page has scrolled about 90-95% of the slider div so the viewer can atleast know he has seen all the images in the slider. The transition speed doesnt matter here. How would thatbe made possible? Currently I changed the width of slider to 3200px for 8 images and added 3 new images 6,7,8.jpeg. but obviously the 7-8th dont manage to come in the view.

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

      You know, tbh a solid kick a$$ solution in cases of 8+ images could be to detect which images have gone offcanvas on the negative X axis, then append them on the div below and translate them in reverse towards the positive X axis giving us 2 rows of moving images in alternate directions. What do you say? :D

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

      @@theman7050 sounds good mate. Also sounds like it will be a tricky one to get the calculations correct (as my maths is pretty terrible haha 😅) but will look amazing when done!

  • @mimitecrazy
    @mimitecrazy 3 года назад

    When i print imagewidth i get 0

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

    I get this error: "Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect')
    at init (app.js:18)
    at app.js:30" (line 18 is function init and line 30 is calling this function.) I did everything the same... why is it null?

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

      Hi Tina. Can you send a link to your code via codepen or GitHub? I can take a look. Looks like the image containers are not being selected as the code is returning null. Thanks. Conor

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

      @@ConorBailey I'll send the code soon. Thank you.

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

    my setTransform() isn't working it's throwing syntax error pls help

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

      just found out it worked as Stransform thanks

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

    I did every code and followed your steps, but my images would not show on the screen. It's just a black page. Any suggestions?

    • @christoffersrensen2068
      @christoffersrensen2068 3 года назад

      meaning, when I type in the img.style.backgroundImage = `url(./images/${idx+1}.jpeg)`, it wont collect my images

    • @ConorBailey
      @ConorBailey  3 года назад

      @@christoffersrensen2068 hey mate can you put your code on code pen. I’ll take a look. Maybe the image div size hasn’t been set or something? Any errors in the console?

    • @christoffersrensen2068
      @christoffersrensen2068 3 года назад

      @@ConorBailey I have no errors in the console. codepen.io/christoffer-traynor-s-rensen/pen/WNpoRWg

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

      @@christoffersrensen2068 I have the same problem. could you fix it?

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

      @@ConorBailey I have the same problem. could you fix it?

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

    how to make same slider with only draggable not scrollable, please help
    🤐🤔😔

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

      ruclips.net/video/LPBGK1gqXoU/видео.html

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

      This may help. This is a draggable slider so you will just have to try to merge the 2 ideas.

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

      Thank you sir for reply.....

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

      I try my best if i have any doudt i ask you...

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

      @@ConorBailey sir i try but it not work 😕😟😰. sir can you make it please please sir.... , i have collage project so i want put this slider in my project. i try but i can't do it...... can make same slider with draggable only.please please sir

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

    Please Source code 🥺🥺

  • @Yasir-dev
    @Yasir-dev Месяц назад

    Provide source code

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

    if your image don´t show make sure you have all the image same like.
    1.jpeg 2.jpeg 3.jpeg 4.jpeg 5.jpeg 6.jpeg ✔
    1 .jpeg 2.jpeg 3.jpeg 4 .jpeg 5.jpeg 6.jpeg ❌ it´s have space. 1.jpeg ( 1 .jpeg ), 4.jpeg ( 4 .jpeg ),

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

      you're a good poop finder, but bad developer

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

    On line 24
    document.body.style.height = `${sliderWidth - window.innerWidth / 2}px`;
    this line works as well

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

    everything works perfectly except the

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

      @Jb Xn I did it but it stills not working

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

      this is a problem I came across too. I tried changing the paths of the folders but it does not work
      My images are located in this style
      img:
      1.jpeg
      But the code does not render in JavaScript as of recently!