Jump to content
Search Community

How can I build multi pages?

raana test
Moderator Tag

Recommended Posts

Hi @raana,

 

Thanks for being a club GreenSock member!

Have you taken a look at draggable?

This sounds like quite a complex problem to solve so I'm *just* taking a guess here - but I'd probably try to use the onDrag event, maybe map the minX and minY coordinates to a tween that moves one of the pages?
 

onDrag

Function - A function that should be called every time the mouse (or touch) moves during the drag. Inside that function, this refers to the Draggable instance (unless you specifically set the scope using callbackScope), making it easy to access the target element (this.target) or the boundary coordinates (this.maxX, this.minX, this.maxY, and this.minY). By default, the pointerEvent (last mouse or touch event related to the Draggable) will be passed as the only parameter to the callback so that you can, for example, access its pageX, pageY, target, currentTarget, etc. This is only called once per requestAnimationFrame.

 



An easier task would be to initially try to implement click event listeners on the pages, then on click, tween to the previous or next page.

It's a lot like a slider or carousel really so taking a look at some slider demos might help with the logic!


See the Pen JjomKjq by GreenSock (@GreenSock) on CodePen

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