//公用Tab function tabClass(t,c){ var e=$(t).children(); var c=$(c).children(); e.find('li').click(function(){ if($(this).hasClass('active')) return false; e.find('li').removeClass('active'); $(this).addClass('active'); var index=$(this).index(); c.hide().eq(index).stop().fadeIn(); }) } //网页轮播图 $(document).ready(function(){ var jWindow = $(window); //窗口改变时加载; $('#CloseWeeb').click(function(){ $('#WeeboxBg,#WeeBoxcon').animate({'left':-jWindow.width()},500,'easeOutBounce',function(){ $('#WeeboxBg').css('left',jWindow.width()); $('#WeeBoxcon').css({'left':jWeebConLeft}); }) }) var jLen = $('#ConentBox').find('.focus-each').length; var i=0; var jTime = null; var jEachWidth = jWindow.width(); $('#focusBox').css('width',jWindow.width()) $('#ConentBox').find('.focus-each').css('width',jEachWidth); $('#ConentBox').css('width',jEachWidth*jLen+jEachWidth); var jfocus={ jPicScroll:function(index){//写个函数来调用; i=index; $('#ConentBox').stop(true,true).animate({'left':-jEachWidth*i},400,'easeInOutExpo') $('.fo-number li:eq('+i+')').addClass('acitve').siblings().removeClass('acitve'); }, jPicLast:function(){//最后一张图的接口; $('#ConentBox').append($('#ConentBox .focus-each:first').clone()); var jNewLeft = jLen*jEachWidth; $('#ConentBox').animate({'left':-jNewLeft},200,function(){ $('#ConentBox').css('left',0).find('.focus-each:last').remove(); }) $('.fo-number li:eq(0)').addClass('acitve').siblings().removeClass('acitve'); }, play:function(){ jfocus.jPicScroll(i); i++; if(i>jLen){ jfocus.jPicLast() i=0; } } } jTime=setInterval(jfocus.play,2000); $('#focusBox').mouseenter(function(){ clearInterval(jTime); }).mouseleave(function(){ jTime=setInterval(jfocus.play,2000); }) $('.fo-number li').mouseover(function(){ index = $(this).index(); jfocus.jPicScroll(index) }) }) function TopNav() { $(".nav").find("dd").mousedown(function () { $(this).parent().children("dd").removeClass("active"); $(".acitve").removeClass("acitve"); $(this).addClass("acitve"); }); $(".nav").find("dd").mousemove(function () { $(this).parent().children("dd").removeClass("acitve1"); $(".acitve1").removeClass("acitve1"); $(this).addClass("acitve1"); }); $(".nav").find("dd").mouseout(function () { $(this).parent().children("dd").removeClass("acitve1"); }); } $(function () { TopNav(); }); (function(){ $('.nav dd').hover(function(){ $(this).find('.subNav').stop().fadeIn(200); },function(){ $(this).find('.subNav').stop().fadeOut(200); }); $('.mainNav li:last-child').css('border',0); })(); //理财工具切换 $(function() { var sWidth = $("#focus").width(); var len = $("#focus ul li").length; var index = 0; var picTimer; var btn = "
"; $("#focus").append(btn); $("#focus .preNext").css("opacity",0.2).hover(function() { $(this).stop(true,false).animate({"opacity":"0.5"},300); },function() { $(this).stop(true,false).animate({"opacity":"0.2"},300); }); $("#focus .pre").click(function() { index -= 1; if(index == -1) {index = len - 1;} showPics(index); }); $("#focus .next").click(function() { index += 1; if(index == len) {index = 0;} showPics(index); }); $("#focus ul").css("width",sWidth * (len)); function showPics(index) { var nowLeft = -index*sWidth; $("#focus ul").stop(true,false).animate({"left":nowLeft},300); } }); //定投 $(function() { var sWidth = $("#focus1").width(); var len = $("#focus1 ul li").length; var index = 0; var picTimer; var btn = ""; $("#focus1").append(btn); $("#focus1 .preNext").css("opacity",0.2).hover(function() { $(this).stop(true,false).animate({"opacity":"0.5"},300); },function() { $(this).stop(true,false).animate({"opacity":"0.2"},300); }); $("#focus1 .pre").click(function() { index -= 1; if(index == -1) {index = len - 1;} showPics(index); }); $("#focus1 .next").click(function() { index += 1; if(index == len) {index = 0;} showPics(index); }); $("#focus1 ul").css("width",sWidth * (len)); function showPics(index) { var nowLeft = -index*sWidth; $("#focus1 ul").stop(true,false).animate({"left":nowLeft},300); } }); $(function() { var sWidth = $("#focus2").width(); var len = $("#focus1 ul li").length; var index = 0; var picTimer; var btn = ""; $("#focus2").append(btn); $("#focus2 .preNext").css("opacity",0.2).hover(function() { $(this).stop(true,false).animate({"opacity":"0.5"},300); },function() { $(this).stop(true,false).animate({"opacity":"0.2"},300); }); $("#focus2 .pre").click(function() { index -= 1; if(index == -1) {index = len - 1;} showPics(index); }); $("#focus2 .next").click(function() { index += 1; if(index == len) {index = 0;} showPics(index); }); $("#focus2 ul").css("width",sWidth * (len)); function showPics(index) { var nowLeft = -index*sWidth; $("#focus2 ul").stop(true,false).animate({"left":nowLeft},300); } }); $(function() { var sWidth = $("#focus3").width(); var len = $("#focus3 ul li").length; var index = 0; var picTimer; var btn = ""; $("#focus3").append(btn); $("#focus3 .preNext").css("opacity",0.2).hover(function() { $(this).stop(true,false).animate({"opacity":"0.5"},300); },function() { $(this).stop(true,false).animate({"opacity":"0.2"},300); }); $("#focus3 .pre").click(function() { index -= 1; if(index == -1) {index = len - 1;} showPics(index); }); $("#focus3 .next").click(function() { index += 1; if(index == len) {index = 0;} showPics(index); }); $("#focus3 ul").css("width",sWidth * (len)); function showPics(index) { var nowLeft = -index*sWidth; $("#focus3 ul").stop(true,false).animate({"left":nowLeft},300); } }); //左右图片滚动 function lrScroll(obj,prev,next){ var n = 0; var $div = $(obj); var liNum = $('li',$div).size(); var liW = $('li',$div).outerWidth() + 40; $('ul',$div).width(liNum * liW); $(prev).click(function(){ if($('ul',$div).is(":animated")){return false}; n-1 < 0 ? n = Math.ceil(liNum/4)-1 : n--; $('ul',$div).animate({marginLeft:-n*liW*4}); }); $(next).click(function(){ if($('ul',$div).is(":animated")){return false}; n+1 >= liNum/4 ? n = 0 : n++; $('ul',$div).animate({marginLeft:-n*liW*4}); }); }; //弹出 $(function(){ $(".look").click(function(){ $("#TB_overlayBG").css({ display:"block",height:$(document).height() }); $(".box_one").css({ left:($("body").width()-$(".box_one").width())/2-20+"px", top:($(window).height()-$(".box_one").height())/2+$(window).scrollTop()+"px", display:"block" }); }); $(".close").click(function(){ $("#TB_overlayBG").css("display","none"); $(".box_one ").css("display","none"); }); })