Jump to content


How can I build multi pages?

Recommended Posts

Hi, I want to learn how to make book pages. With what I have learned so far, I was only able to show the divs one after the other, but this is not enough at all and it has many problems. I want the pages to change and drag smoothly after dragging.


my cod in codesandbox and https://codesandbox.io/s/test-drag-g9bkc

See the Pen by (@) on CodePen

Link to comment
Share on other sites

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?


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


Thank you very much, I did not know it needs to be on before, I wrote according to the tutorials and examples  Dagstart. 😁

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.