Merging Image Boxes with jQuery

Today we will show you a nice effect for images with jQuery. The idea is to have a set of rotated thumbnails that, once clicked, animate to form the selected […]

Today we will show you a nice effect for images with jQuery. The idea is to have a set of rotated thumbnails that, once clicked, animate to form the selected image. You can navigate through the images with previous and next buttons and when the big image gets clicked it will scatter into the little box shaped thumbnails again.

When the window gets resized, the positions of the thumbnails will automatically adapt to fit the screen. We are using the jQuery 2D Transform plugin for the animated rotation. You can find the plugin here:

The beautiful photographs are by tibchris and you can find his stunning works on his Flickr page:

When navigating through the full images, we will reveal the next or previous image by removing the current image box by box.

Have fun with the demo and download the ZIP to experiment with this cool effect!
The whole animation looks best in Google Chrome and Apple Safari.

Tagged with:

Manoela Ilic

Manoela Ilic is the founder and owner of Codrops. With her background in coding and passion for all things design, she creates web experiments and keeps frontend professionals informed about the latest trends in the community. She enjoys gardening and learning about off-grid living, as well as staying up-to-date on the latest industry trends and technologies.

Stay in the loop: Get your dose of frontend twice a week

๐Ÿ‘พ Hey! Looking for the latest in frontend? Twice a week, we'll deliver the freshest frontend news, website inspo, cool code demos, videos and UI animations right to your inbox.

Zero fluff, all quality, to make your Mondays and Thursdays more creative!

Feedback 88

Comments are closed.
  1. Hey, thank you all!
    @Johannes you just need to set the variable “per_line” to the according number. Then you add the thumbnails in the HTML with the correct background-position. You need to have a correct size of images so that all the thumbs together make up that image. Hope it helps,

  2. That’s BEAU-TI-FUL, well done. One of the most neat jQuery examples out there ๐Ÿ™‚ . Keep up the great work!

    • …and why exactly would I do that? ๐Ÿ™‚ I don’t try to make it work in Firefox 1.5, either…

  3. we…ee…eee…Could be so like that, its a great, photograph of womens are the beautiful too, to be inverted view…:D

  4. Love it, although I noticed the animation seems choppy and slow in Firefox. Works great in other browsers tho!

  5. Thank you all so much for your great feedback, I am really glad you like it ๐Ÿ™‚
    Cheers, ML

  6. Wow. It amazes me what people can come up with when they explore jQuery a bit.
    Great work, Mary.

  7. Very nice. I love what brilliant people can accomplish with a little jquery sauce.

  8. Wow god effect..
    Pero como siempre existe ello…venga no habra pensando en volver a el menu de las imagenes en vez de seguir en vista completa de ellas…

  9. Great!!! Any option to set the background positions with Jquery, depending on the number of thumbnails you want to show?

  10. This is a cool effect, but you need to work on the performance of it outside of Chrome. It’s sluggish to respond in Firefox 3.6.13, and more sluggish in IE8. Oddly enough it runs better in IE7 than IE8.

  11. If I set he variable โ€œper_lineโ€ to the according number and add the thumbnails in the HTML with the correct background-position, the image is cut at the bottom as if it needs “phantom” thumbnails and lines. Any changes other than 6linesx24thumbs messes up things.

  12. Yeah, that’s great, but you would have to use some system tests to ensure that it only shows on decent systems.

    I’m on my development laptop right now, which is about 8 years old, and it completely hung the tab for a few seconds when I opened the demo. That’s the sort of stuff which makes people close your website without even thinking.

  13. Well, if we would keep on developing stuff for 8 year old computers, we wouldn’t really get anywhere, would we?

  14. Now I’m curious. An 8-year-old laptop? That is designated “development?” And is STILL working?

    Not slamming here, but just flabbergasted. ๐Ÿ˜‰

  15. Hey mary great work… please help me i want use it.
    only within a div of 800 x 600 and do not make it always shows the entire width of the screen … please urgent

  16. It is! I also write a lot of javascript/jquery code but yours is so functional and so clean.