(function ($) { $.fn.extend({ "liteNav": function (t) { var $this = $(this), i = 0, $pics = $(this).find('#NewsPic'),$i=$pics.find('a').length-1, autoChange = function () { var $currentPic = $pics.find('a:eq(' + (i + 1 === $i ? 0 : i + 1) + ')'); $currentPic.stop().show().animate({opacity:1}).siblings('a').stop().animate({opacity:0}).hide(); $pics.find('.Nav>span:contains(' + (i + 2 > $i ? $i - i : i + 2) + ')').attr('class', 'Cur').siblings('span').attr('class', 'Normal'); $pics.find('#NewsPicTxt').html('' + $currentPic.find('img').attr('title') + ''); i = i + 1 === $i ? 0 : i + 1; }, st = setInterval(autoChange, t || 2000); $this.hover(function () { clearInterval(st); }, function () { st = setInterval(autoChange, t || 2000) }); $pics.find('.Nav>span').hover(function () { i = parseInt($(this).text(), 10) - 2; autoChange(); }); } }); $.fn.extend({ "liteNav2": function (t) { var $this = $(this), i = 0, $pics = $(this).find('#NewsPic2'),$i=2, autoChange = function () { var $currentPic = $pics.find('div.txshow_1:eq(' + (i + 1 === $i ? 0 : i + 1) + ')'); $currentPic.parent('#NewsPic2').stop().animate({left:1200*i*(-1)+"px"}) $this.find('.Nav>span:contains(' + (i + 1 > $i ? $i - i : i + 1) + ')').attr('class', 'Cur').siblings('span').attr('class', 'Normal'); i = i + 1 === $i ? 0 : i + 1; }, st = setInterval(autoChange, t || 2000); $this.hover(function () { clearInterval(st); }, function () { st = setInterval(autoChange, t || 2000) }); $this.find('.Nav>span').hover(function () { i = parseInt($(this).text(), 10) - 1; autoChange(); }); } }); }(jQuery));