Jump to content
Search Community

Positioning problem

Cor test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I have a problem getting image tweened in the correct position.
The filmstrip width is 1920 px.

When images are positioned staticly the first left is 20 px.

Every picture width is 200 px.

The space between 2 images is 40 px.

But when tweening images into place, the position is not correct.


Or what am I doing wrong?


Link to comment
Share on other sites

Hello Cor and Welcome to the GreenSock Forums!


This is just an issue with CSS setup. Here is an example of the images aligned on the filmstrip:


See the Pen IrpaE by jonathan (@jonathan) on CodePen


What i did was:

  • i created a rule for #banner and added position:relative to the #banner div so this way the absolutely positioned children are absolutely positioned relative to its parent (#banner)
  • I added float:left and changed display:inline-block to display:block to your #banner div selector (since you have a width and height defined for #banner div selector than it is better to use display:block due to browser bugs with display:inline-block)
  • I also added top:0px  and left:0px to #banner_bg to make sure it set at default top 0 and left 0

I hope this helps! :)

  • Like 1
Link to comment
Share on other sites

Hi Cor,


It sounds like it could be quite a challenge to get each individual image to resize, move, and maintain aspect ratio as your filmstrip image is being scaled.

You original post mentioned very specific widths and spacing parameters in pixels (which is what Jonathan provided a solution for). Making it responsive however requires a lot more work on the css side.



I would probably recommend against using the long film-strip image and just create the whole thing using responsive css. Unfortunately, doing elaborate responsive layouts is a bit beyond our core focus on the GSAP api.


Here is an example that might work as a starting point for getting the film-strip images to be responsive, as opposed to being in a long static image: http://codepen.io/GreenSock/pen/5821c202caac77d1d04ffc67bc50b1cb/


resize your window as the animation plays. 

  • Like 2
Link to comment
Share on other sites

Hi Carl,


CSS is really my worst field.

I understand the challenge, in fact I was thinking of it a good part of the night.

FYI, I use bootstrap as framework and now trying to get around some GSAP usage.


So just out of bed, I was thinking of trying it in GSAP with scale on update or something like that?


Now the www-world is getting more and more into responsive design and mobiles first, I think I spot a GSAP-challege...


Maybe it is a good idea to extend GSAP to a full (responsive) framework... :oops:

That would be shockingly green! :mrgreen:


Thanks for your support and I hope you guys continu the challenge!!

Link to comment
Share on other sites

Thanks Carl, your pen is the solution!

I had it working within 30 minutes.


I started to tune it so it gets clever....

And then I screwed something up badly without having a roll back. :ph34r:

And restoring it, made everything worse!!! :angry:

So Murphy's Law works!!! :lol:


OK, I have it working again and responsive.

But there is a little twitch.

When the screen is resized to any smaller then 100%, the images give a sort of after effect.

It is not because of force3D:true.


Is this due to percentage resizing and images having a floating point size?


I just created a pen so others can benefit when using Bootstrap: 

See the Pen bBHGj by codo (@codo) on CodePen


Please feel free to correct this!!


Next steps is a great array with pictures and they switch randmly in the filmstrip.

Suggestions up front are welcome!

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