Thanks Jamie and Jack. I've attached a zip showing what I'm trying to do. All .js, .css and html are in index.html in the folder.
So basically, I'm creating an interactive slideshow that lets the user interact with the images, zoom them in for a better look, and save them to their folder.
I have a bunch of images in divs. A class on each image div determines it's z-index and width as a percentage of the browser width. Images float from bottom to top of screen. The x position is determined as a percentage of the browser width and is set randomly within a range. I use jquery to loop through the image divs, create a bunch of tweens, and then fire the tweens on interval so that no more than 6 tweens are running at once.
As the tweens move from bottom to top, you can click on them to pause them and pop them above the other images. Clicking on the zoom icon creates a new tween to scale the image up via setting the width of it's parent div. It also adds a rotation. Eventually there will be an info pane next to it. Clicking the close button reverses that tween, creates a new bottom to top tween, and uses the progress saved when the tween was stopped before to make the tween continue on it's way.
Additionally, you can drag the images to the folder at the bottom of the screen. Later, you'll be able to bring focus to that folder, which will cover the screen and show you the images you'd saved before and let you sort them, remove them, etc. That will mean different styles being applied to the same elements.
So the zoom tween is setting the width of the image, and although it is declared as a percentage, and the class that originally sets the width of the image is a percentage, after that zoom tween is reversed, there is a pixel width still sitting on the style attribute of the div. Intuitively, I'd think that if a tween is reversed it'd go back to the original state, which didn't have a width in the style. Additionally, the left is now set to a pixel value and not a percentage. Resizing the browser shows that any images that have been zoomed are now fixed, as the other images scale their widths and locations.
I put the top, left, width and rotation along with the z-index in the .zoom class but the top and left won't update for me there. Not sure what the deal is.
To summarize, I create a tween, stop it, run a new tween for the zoom, reverse it, and then continue the original tween. After that, values on the style attribute are set to pixels instead of percentages, css properties that have been tweened and reversed are still present and they override stylesheets previously applied.
If tweening the class worked reliably and it removed the data on the style attribute on complete, it seems that might solve the problem. Otherwise, it looks like I'll have to write an onComplete method to search for and remove styles manually.
It seems it'd be good to have an optional GSAP method to call, or a flag to set on an animation to clear all styles not being animated or clear specific styles. (cleanOnComplete/cleanOnCompleteParams? or TweenMax.cleanStyles(targetObject, [targetStyles])?) That could be set on the tween or called on complete to tidy things up.
Again, thanks for your input and help.
image-collection.zip