Custom Web Design by Rainbo Design


  

JavaScript Slideshow
With Flipping Tiles

This slideshow changes slides in four flipping tiles. The actual effect is done by gradually reducing the width of each tile, swapping images once the width reaches 0, and then expanding the tile back to its normal width. Once all four tiles have changed, the image is allowed to remain for a short time. Then the cycle repeats itself. This version of the slideshow requires PHP and GD Library support in order to generate the tiles. It is compatible with either the manual or the automatic slide file list generating scripts.

It took quite a while to get this code working well. Mostly, I just wasted a lot of time trying to shoehorn the swap change code into my primary JavaScript slideshow framework. Then I ran into a problem with how browsers update images. The animation worked properly, but the images didn't change until all four tiles had flipped. I solved that with a small bit of code that pre-fetches the next set of tiles after each slide change sequence.


When I started to create this version, I had intended to rely only on CSS to create the tiles - positioning the image with an offset that would only display the portion of the image appropriate for the tile. This would certainly have been more efficient in terms of server load and speed, but I was concerned that it wouldn't be visually pleasing. So I created a PHP script that generates the tiles dynamically.

For this version of my slideshow script it's even more important that all of the image files be the same size. While it will function with varying slide sizes, it looks horrible. It's also best if the height and width dimensions are even numbers. You'll also want to customize the value of the JavaScript variable "delay" which controls the speed with which the tile-changing effect proceeds. The best value will depend on the width of your slide image files.

One thing I haven't mentioned before is that my sample slides from Disneyland demonstrate that it would often be handy to customize the JavaScript to allow for a selectable position for the titles. I'd suggest adding a parameter to the entries in the titles file to include a position command such as "top" or "bottom", and then have the code alter the CSS position setting for "t2BoxObj". You could also add the ability to change the font color.


This page was last modified on August 27, 2020


Copyright © 2005-2024 by Richard L. Trethewey - Rainbo Design Minneapolis. It's not that I think this is such an earth-shatteringly great presentation, but if you want to copy it, I'd appreciate it if you would ask for permission. I've been working with computers for over 30 years now, and one phrase keeps popping into my head - "I hate it when it's right!" And laptops and smartphones are no better.

Looking for more website design information? See my Sitemap!