Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                  <!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8" />
    <title>Infinite Rotating Images Using jQuery (JavaScript)</title>
    <script src="//"></script>
    <script src="//"></script>
    <script type='text/javascript' src='js/infinite-rotator.js'></script>
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
    <h1>Infinite Rotating Images Using jQuery (JavaScript)</h1>
    <!-- START: Rotating Images -->
    <div id="rotating-item-wrapper">
      <img src="" alt="a person entering a building" class="rotating-item" width="980" height="347" />
      <img src="" alt="photo of building across from our office" class="rotating-item" width="980" height="347" />
      <img src="" alt="building entrance with neon backlit walls" class="rotating-item" width="980" height="347" />
      <img src="" alt="building lobby window reflections" class="rotating-item" width="980" height="347" />
      <img src="" alt="reflection on building windows" class="rotating-item" width="980" height="347" />
      <img src="" alt="two manequines in window" class="rotating-item" width="980" height="347" />
      <p style="display:none;">Source code and instructions at: <a href="">Infinite Loop: Rotating Images Using jQuery (JavaScript)</a><br/>by <a href="">San Francisco WordPress website designers and developers - TrendMedia</a></p>
    <!-- END: Rotating images images -->


                #rotating-item-wrapper {
	position: relative;
	width: 980px;
	height: 347px;
.rotating-item {
	display: none;
	position: absolute;
	top: 0;
	left: 0;


                // Copyright (c) 2010 TrendMedia Technologies, Inc., Brian McNitt. 
// All rights reserved.
// Released under the GPL license
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// **********************************************************************

$(window).load(function() {	//start after HTML, images have loaded

	var InfiniteRotator = 
		init: function()
			//initial fade-in time (in milliseconds)
			var initialFadeIn = 1000;
			//interval between items (in milliseconds)
			var itemInterval = 5000;
			//cross-fade time (in milliseconds)
			var fadeTime = 2500;
			//count number of items
			var numberOfItems = $('.rotating-item').length;

			//set current item
			var currentItem = 0;

			//show first item

			//loop through the items		
			var infiniteLoop = setInterval(function(){

				if(currentItem == numberOfItems -1){
					currentItem = 0;

			}, itemInterval);