jQuery(function($) { $('#frontvideoinner .slideshow .slide:not(:first)').hide(); $('#frontvideoinner2 .slideshow .slide:not(:first)').hide(); window.setInterval('changeSlide();', 4000); window.setInterval('changeSlide2();', 9000); }); var changeSlide = function () { var $ = jQuery; var $parent = $('#frontvideoinner .slideshow'); var $curr = $('#frontvideoinner .slideshow .slide:visible'); var $next = $curr.next('.slide'); $parent.height($curr.outerHeight()); if($next.size() <= 0) { $next = $('#frontvideoinner .slideshow .slide:first'); } $curr.css({'position': 'absolute'}).fadeOut('slow', function() { $(this).css({'position': 'relative'}); }); $next.fadeIn('slow'); return false; } var changeSlide2 = function () { var $ = jQuery; var $parent2 = $('#frontvideoinner2 .slideshow'); var $curr2 = $('#frontvideoinner2 .slideshow .slide:visible'); var $next2 = $curr2.next('.slide'); $parent2.height($curr2.outerHeight()); if($next2.size() <= 0) { $next2 = $('#frontvideoinner2 .slideshow .slide:first'); } $curr2.css({'position': 'absolute'}).hide().css({'position': 'relative'}); $(this).css({'position': 'relative'}); $next2.fadeIn('slow'); return false; }