/* Geekinit.com ############################## Plugin Name: The autoMotion Plugin for Jquery Updated: February 9, 2011 Developer: Jeff Vogelpohl http://preview.geekinit.com/automotion/ License: Free to use for non-profit and commercial purposes as long as this license is in place and in its original context. Warranty: There is no warranty or support. I am not responisble for anything you do with this code. Customiztions: You are welcome to customize the code only, however, you must leave the original license in place. ############################## */ $.autoMotion = function(container, seconds) { var interval = seconds * 1000; var $parent = $("#" + container); if ($parent) { var $children = $parent.children(); if ($children) { $parent.css("visibility", "visible"); $children.hide(); var $length = $children.length; var $swapcount = 0; $.autoSwap = function() { if (interval > 1000) { $children.eq($swapcount).slideDown(); if ($swapcount == 0) { $children.eq($swapcount).delay(interval).slideUp(); $swapcount = $swapcount + 1; } else { if ($swapcount < $length) { $children.eq($swapcount).delay(interval).slideUp(); $swapcount = $swapcount + 1; } else if ($swapcount == $length) { if (interval <= 1000) { $children.eq($swapcount).delay(interval).slideUp(); $swapcount = 0; } else { $swapcount = 0; $children.eq($swapcount).slideDown(); $children.eq($swapcount).delay(interval).slideUp(); $swapcount = $swapcount + 1; } } } } }; $.autoSwap(); $autoInterval = setInterval("$.autoSwap()", interval); } } };