Jump to content
Search Community

Draggable - Dynamic width slides onThrowUpdate

Simon.Gioffredi test
Moderator Tag

Recommended Posts

Hi,


First of all, sorry for my english, I'm not an english native speaker.

 

I try to do a complete Carousel with Draggable.

 

Actually, I use snaps with a basic function :

return Math.round(x / slideWidth) * slideWidth

 

Doing this forces me to use only slides with same width.

 

I try to change that, with slide which size changes when they are "active"

 

But I struggle a lot. Do I need to use liveSnap ?

 

If you have an idea, that could be great :D 

See the Pen JjpNaVa by simon-gioffredi (@simon-gioffredi) on CodePen

Link to comment
Share on other sites

  • Simon.Gioffredi changed the title to Draggable - Dynamic width slides onThrowUpdate

I don't understand your goal, but you can put whatever logic you want inside that snap function - you don't need to use multiples of 500 or any specific size. You'd just need to work out the logic according to whatever sizes you're using. You may be able to use an Array with the specific values according to your sizes. Simple demo:

See the Pen ZEryQQQ?editors=1010 by GreenSock (@GreenSock) on CodePen

 

Working out custom logic for you is beyond the scope of help we typically provide in these free forums, but you're welcome to post in the "Jobs & Freelance" forum to seek paid assistance. 

 

liveSnap is for if you want it to snap immediately WHILE you're dragging. I doubt you want that. 

 

Good luck!

  • Like 1
Link to comment
Share on other sites

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...