Jump to content
Search Community

Creating vertical carousel

marsi

Go to solution Solved by marsi,

Recommended Posts

  • Solution
Posted

Are there any methods of creating a vertical carousel, with the selected item fixed in the center of the screen? I've tried something based on this project, but the results have been unsuccessful. Found alternatives on the forum, codepen didn't give any results either 


Modifiers Plugin for Infinite Image Carousel - GSAP - GreenSock
 

 

275283083_1.png.32fb157cdb1eef41064c75c68cf29750.png

 

Posted

Thank you, your answer makes a great contribution to solving my question, but I would like to know if there are any code examples with vertical card display?

Posted
9 hours ago, marsi said:

I would like to know if there are any code examples with vertical card display?

 

What's wrong the example @mikel linked to? Vertical behavior would be the exact same, just in a different direction. You just need to modify the code so it works on the y axis instead of the x axis.

  • Like 1
Posted

Yes, thank you, it all worked out, if anyone needs an example of a vertical carousel:  

See the Pen KKWYRrE by irtexfree (@irtexfree) on CodePen.

  • Like 1
  • 1 year later...
Posted

Hi, i try to use the same function, but unfortunately the scroll/next/prev actions are always regarding to the body.
If i want to implement it inside div on a page, it always scrolls if the body scroll, and the body jumps up and down, if i click the next or prev button.

Is there a way to reduce this animation only inside a div?

  • 4 weeks later...
chacrasoftware
Posted

Was following all the codepen example above but looks like all of them have this same weird issue, could be something broke from recent gsap update? I have replicated the codepen in our project and has the similar issue

image.thumb.png.896abc3da98ebe30caff5db6c1e81f1c.pngimage.png.685b65688eb3679029275e3b267680ad.png

Posted

 GSAP 3.11.2 is officially live and should resolve this issue. The CDN may take a little extra time to update, but Github, NPM, and the file downloads are all updated now. ?

  • Like 1
  • 8 months later...
Posted

Hi! Is there any way to turn off the endless animation in vertical slider and make it play only once and after it ends the page continues to scroll as before?

Posted

Hi @bananafox and welcome to the GreenSock forums!

 

Sure it can be done, but it might not be the simplest thing. That code is very specific for that use case (infinite scrolling) so modifying it might not be the simplest of tasks.

 

I think it might be simpler to just create a couple of subsets of the elements (like attaching the first three at the end of the array and the last three at the start) and create the effect from scratch using that instead of creating the seamless loop, and just animate that timeline using ScrollTrigger.

 

Another option could be to use the seamless loop method and create a timeline with it and use ScrollTrigger to scrub that particular timeline:

const seamlessLoop = buildSeamlessLoop(cards, spacing, animateFunc);

ScrollTrigger.create({
  trigger: ".my-element",
  start: "top top",
  end: "+=200%",
  scrub: true,
  animation: seamlessLoop,
});

Finally is really hard for us to find issues or provide support without a minimal demo. If you get stuck and have a particular GSAP related question, create one that clearly illustrates the problem you're having so we can take a look.

 

Hopefully this helps.

Happy Tweening!

  • Like 1
Posted

Hi, hope everyone's doing okay. What would be the best way to add an "active" css class to the card in the middle and update that as we scroll? 
Thanks!

Posted

 

Hello there, Tiny.

 

If I am not mistaken, the examples in this thread here are based off of a horizontal version of that carousel, that is highly optimized and uses rather advanced techniques to begin with. So getting to an idealy performant way to achieve what you intend will likely not be the easiest endeavour, and thus would probably take a lot of considertion into account - and it might just not be within the range of what this free support forum can offer.

If you don't mind possible performance drawbacks, you could have a look at the suggestions that were made in this other thread, and try and convert them to match the vertical logic for your needs - the second suggestion made there might be a safer bet with regard to that.
 

Maybe this can help in some way. Happy Tweening!

 

 

  • Like 3
  • 1 year later...
Posted
On 6/21/2021 at 1:38 AM, mikel said:

 

Hey @marsi,

 

How about this?

 

 

 

 

Happy scrolling ...

Mikel

 

I keep seeing iterations of this carousel all over this forum and every example runs into the same issue – the logic breaks as soon as you reduce the number of items down to 6 or less.  The closest I've come is here: 

See the Pen MYgzZBE?editors=1010 by m-shum (@m-shum) on CodePen.

 and even this is a far cry from functional. I just cannot figure out where the 8 or so extra "slides" are coming from – neither in the demo I used, or your demo.

Posted

Hi @m__shum,

 

Indeed as you already mentioned in another thread, the code has some issues with less elements. Unfortunately this is not the simplest of logics to tinker with and try to solve so it works in a specific setup like the one you're aiming for and we don't have the time resources to provide custom demos for our users or solve complex logic issues, is beyond the scope of what we do in these free forums. Maybe another user has the time and tackles this challenge (definitely a fun one, but complex nonetheless) but it might not happen, we just want to manage expectations on the subject. You can search the forums for other threads but I don't recall any variation of this demo for such a specific use case as the one you have in place.

 

You can also post in the Jobs & Freelance forums in order to get help there.

 

Good luck with your project! 👍

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...