Jump to content
Search Community

Flip.fit() with Grid children

Web Bae test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hey all,

 

I'm having a heck of a time flipping grid children around.

 

In this example I'm trying to flip images from grid-one over to target divs in grid-two.

 

I experimented a bit with some grid CSS properties (grid-column-start grid-row-end etc.) thinking that might be making them not fit properly but haven't been able to get something proper working. I thought maybe making a wrapper div that controlled the div position and the just flipping the image between those two divs might be the way to go but still no joy.

 

Any help is appreciated!

 

Have a great weekend.

 

Keegan

See the Pen KKGvpGB by webisbae (@webisbae) on CodePen

Link to comment
Share on other sites

  • Solution

Hey Keegan!

 

Just use the absolute option in the fit() configuration:

Flip.fit(image, targets[index], {
  duration: 3,
  ease: "power1.inOut",
  absolute: true,
});

From the Flip docs:

absolute

Boolean - if true, the target will have its position CSS property set to absolute. This can solve layout challenges with flex and grid layouts, for example.

 

Here is a fork of your codepen:

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

 

Hopefully this helps.

Happy Tweening!

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