Skip to main content
Solved

Interactions / On Drag : Add Drag Direction

  • August 19, 2021
  • 3 replies
  • 17387 views

ma2os

I’m building a simple prototype where a carousel of images can be swiped left/right to go to the next/previous image. I’m using the On Drag interaction but the problem is that it only accounts for one direction.

Imagine you have a strip of 3 images (A, B and C) where each image has the same width as the screen. If B is in the center, I can only use the On Drag interaction to go to either to A or C. Because there’s only one direction I can use.

This could be resolve by adding a specific direction for the On Drag interaction. On Left drag go to A, on Right Drag go to C.

This is a very common pattern. Does anyone figure out if there’s a work-around for this?

Thanks!

Best answer by tank666

Hi @ma2os, On drag trigger works in any direction. You can see some examples in this thread: How does the picture carousel realize the interactive effect of connecting the beginning and the end?

Help Center article:
https://help.figma.com/hc/en-us/articles/360040035834-Prototype-triggers#On_Drag

View original
This topic has been closed for comments

3 replies

tank666
  • 4868 replies
  • Answer
  • August 19, 2021

ma2os
  • Author
  • 1 reply
  • August 19, 2021

Ohhhh!!! I wasn’t aware you can add multiple ‘drags’ interactions to the same element. That’s exactly what I needed. Thanks!


  • 0 replies
  • September 18, 2021

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings