$(function(){ var slider = $("#pics"), sliderPic = $("#pics li"), titleTar = $("#title"), btnTar = $("#slider_btns"); $(sliderPic).each(function(index){ $(slider).append($(sliderPic).eq(parseInt($(sliderPic).length) - index - 1)); $(btnTar).append("
  • "+parseInt(index + 1)+"
  • ") }); $.classOperation($(btnTar).find("li"),0,"cur_btn",function(){ $(titleTar).empty(); $(sliderPic).eq(0).find("a").clone(true).appendTo($(titleTar)); }); var tFade = null, tFadeIndex = 0, tFadeTemp = 0; tFade = setInterval(function(){ tFadeIndex = parseInt(tFadeIndex + 1) === $(sliderPic).length ? 0 : parseInt(tFadeIndex + 1); $.picFade($(sliderPic),tFadeIndex,800,function(){ $.classOperation($(btnTar).find("li"),tFadeIndex,"cur_btn",function(){ $(titleTar).empty(); $(sliderPic).eq(tFadeIndex).find("a").clone(true).appendTo($(titleTar)); }); $.classOperation($(btnTar).find("li"),tFadeIndex,"cur_btn") }); },5000); $(btnTar).find("li").each(function(){ $(this).hover(function(){ clearInterval(tFade); $(this).click(function(){ $.picFade($(sliderPic),$(this).index(),800); $.classOperation($(btnTar).find("li"),$(this).index(),"cur_btn"); $(titleTar).empty(); $(sliderPic).eq($(this).index()).find("a").clone(true).appendTo($(titleTar)); $.classOperation($(btnTar).find("li"),$(this).index(),"cur_btn") }); },function(){ tFadeIndex = $("#slider_btns li.cur_btn").index(); tFade = setInterval(function(){ tFadeIndex = parseInt(tFadeIndex + 1) === $(sliderPic).length ? 0 : parseInt(tFadeIndex + 1); $.picFade($(sliderPic),tFadeIndex,800,function(){ $.classOperation($(btnTar).find("li"),tFadeIndex,"cur_btn",function(){ $(titleTar).empty(); $(sliderPic).eq(tFadeIndex).find("a").clone(true).appendTo($(titleTar)); }); $.classOperation($(btnTar).find("li"),tFadeIndex,"cur_btn") }); },5000); }); }); var selectInner = $("#innerlink"), selectOuter = $("#outerlink"); $(selectInner).change(function(){ if($(this).val() != ""){ window.open($(this).val(),"new") } else{ return false; } }); $(selectOuter).change(function(){ if($(this).val() != ""){ window.open($(this).val(),"new") } else{ return false; } }); }); (function(){ $.fn.extend({ sFadeIn:function(speed,callback){ return this.animate({ opacity:"show" },speed,function(){ if($.browser.msie && this.style.filter){ this.style.removeAttribute("filter"); }; if(callback && $.isFunction(callback)){ callback(); } }); }, sFadeOut:function(speed,callback){ return this.animate({ opacity:"hide" },speed,function(){ if($.browser.msie && this.style.filter){ this.style.removeAttribute("filter"); }; if(callback &&$.isFunction(callback)){ callback(); } }) } }); $.extend({ picFade:function(obj,index,speed,callback){ $(obj).eq(index).siblings() .sFadeOut(speed); $(obj).eq(index).sFadeIn(speed); if(callback && $.isFunction(callback)){ callback(); }else{} }, classOperation:function(obj,index,className,callback){ $(obj).eq(index).removeClass(className).addClass(className) .siblings().removeClass(className); if(callback && $.isFunction(callback)){ callback(); } } }); })(jQuery);