$(document).ready(function(){ var speed = 5000; var stop = 0; var trgt = ''; var newsLinkPic = $('#featured div.ui-tabs-panel'); var newsLink = $('#featured ul.ui-tabs-nav li'); /* alert("Hello" + newsLinkPic.length); */ $("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", speed, true); $(newsLink).hover(function(){ $("#featured").tabs("rotate", stop, true); $('#featured ul.ui-tabs-nav li.ui-tabs-selected').removeClass('ui-tabs-selected'); $(this).addClass('ui-tabs-selected'); trgt = $(this).children('a').attr('href'); $(newsLinkPic).addClass('ui-tabs-hide').hide(); $(trgt).removeClass('ui-tabs-hide'); $(trgt).show(); }, function(){ $("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", speed, true); }); });