Rotating Images - Timed Image Swap

The Rotate Images JavaScript swaps images automatically on a timer. The code supports many options and features, such as:

  • Sequential or random rotation.
  • Rotate linked or unlinked images. Linked images can all have the same destination URL or each can specify its own.
  • Rotate titles or captions along with image rotation.
  • Rotate virtually unlimited multiple instances.
  • Customizable rate of rotation.
  • Images of varying dimensions can be included in the rotation.
  • Pause/resume rotation onmouseover/mouseout of linked images.
  • Optional transition filter for Internet Explorer on Windows.[1]
  • Open a sub-window or call a custom function onclick of linked rotating images.

The JavaScript Image Rotator is object-oriented and unobtrusive, with easy setup. Basic instructions guide you in the use of the code to suit your purposes. A download file contains the code and example documents.

The code can be extended using php, for example by using a php directory listing as the source of images to be rotated.

See Licensing Information for use of the code. Please read dyn-web's Terms of Use if you plan to use our code.

Browser Support

Support for modifying the src attribute of image tags goes back to the early days of JavaScript, but some of the code's features require more up to date browsers.

The code has been successfully tested on the following browsers: Internet Explorer 5.5+, Firefox, Chrome, Opera and Safari. Other relatively up-to-date standards compliant browsers would also be supported.

Back to top


  1. Cross browser opacity manipulation is not included in this code.^