Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html14/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
- <title>
- header fade in out
- </title>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?ver=3.0.1">
- </script>
- <script type="text/javascript">
- //code by Jack Keller and found on www.icodesnippet.com
- $(document).ready(function($){
- $(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
- $('.rotating-item').eq(currentItem).fadeIn(initialFadeIn);
- //loop through the items
- var infiniteLoop = setInterval(function(){
- $('.rotating-item').eq(currentItem).fadeOut(fadeTime);
- if(currentItem == numberOfItems -1){
- currentItem = 0;
- }else{
- currentItem++;
- }
- $('.rotating-item').eq(currentItem).fadeIn(fadeTime);
- }, itemInterval);
- }
- };
- InfiniteRotator.init();
- });
- });
- </script>
- <style type="text/css" media="all">
- div#rotating-item-wrapper {
- position: relative;
- width: 1000px;
- height: 288px;
- }
- img.rotating-item {
- display: none;
- position: absolute;
- top: 0;
- left: 0;
- }
- </style>
- </head>
- <body>
- <div id="rotating-item-wrapper">
- <img class="rotating-item" src="http://greenhillsoaps.com/wp-content/uploads/2012/01/cropped-iStock_000017900426Large.jpg" alt="#########"/>
- <img class="rotating-item" src="http://greenhillsoaps.com/wp-content/uploads/2012/01/cropped-iStock_000018253040Medium.jpg" alt="#########"/>
- <img class="rotating-item" src="http://greenhillsoaps.com/wp-content/uploads/2012/01/cropped-iStock_000005274216Medium.jpg" alt="#########"/>
- <img class="rotating-item" src="http://greenhillsoaps.com/wp-content/uploads/2012/01/cropped-iStock_000005576609Medium.jpg" alt="#########"/>
- <img class="rotating-item" src="http://greenhillsoaps.com/wp-content/uploads/2012/01/cropped-iStock_000004795672Medium.jpg" alt="#########"/>
- <img class="rotating-item" src="http://greenhillsoaps.com/wp-content/uploads/2012/01/cropped-iStock_000014561712Medium.jpg" alt="#########"/>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement