/*animate*/ function AddAnimate(obj,className,b){ if (window.applicationCache) { obj.addClass(className); if (b) { obj.show(); setTimeout(function(){ obj.removeClass(className); },500) }else{ setTimeout(function(){ obj.removeClass(className).hide(); },30) } } else { if (b) { obj.show(); }else{ obj.hide(); } } } /*tab fn*/ function tab(tabs,cont,i){ tabs.removeClass("active") cont.removeClass("show") tabs.eq(i).addClass("active") cont.eq(i).addClass("show") } function noticeFn(){ var notestimer = null; var news_li=0; notestimer = setInterval(function(){ $('.news_li').animate({"top":-(news_li*19)+"px"}) news_li++; if (news_li == $('.news_li li').length-1) { news_li =0; } },3000); $('.news_li').hover(function(){ clearInterval(notestimer); },function(){ notestimer = setInterval(function(){ $('.news_li').animate({"top":-(news_li*19)+"px"}) news_li++; if (news_li==$('.news_li li').length) { news_li =0; } },2000); }) } $(function(){ noticeFn();//通知; /*top_code*/ $(".phone_er").hover(function(){ $(this).addClass("hover") },function(){ $(this).removeClass("hover") }) /*login_code*/ var codeTimer = null; $(".code_btn").click(function(){ if ($(this).hasClass("hover")) { $(".code_btn").removeClass("hover") $(".code_btn img").animate({"top":"0","left":"0"},200) $(".code_box").removeClass("hover") }else{ $(this).addClass("hover") $(".code_btn img").animate({"top":"-42px","left":"-46px"},200) $(".code_box").addClass("hover") } }) /*index_selling*/ $(".selling .tab li").click(function(){ var _index = $(this).index(); tab($(".selling .tab li"),$(".selling .cont_box .cont"),_index) }) /*index_tool*/ $(".tool li,.mall_nav li").hover(function(){ $(this).addClass("hover") },function(){ $(this).removeClass("hover") }) /*index_news_box*/ $(".huodong h3 span").click(function(){ var _index = $(this).index(); tab($(".huodong h3 span"),$(".huodong .cont ul"),_index) }) /*mall_nav top*/ for (var i=0;i<$(".mall_nav li").length;i++ ) { var liB = $(".mall_nav li").eq(i).find(".mall_links") var nLi_top = $(".mall_nav li").eq(i).offset().top-$(".mall_banner").offset().top; var nLi_hb = $(".mall_banner").innerHeight()-($(".mall_nav li").eq(i).offset().top-$(".mall_banner").offset().top) var ml_H = liB.innerHeight(); if (ml_H>nLi_hb) { liB.css("top",nLi_hb - ml_H -2 + "px") } } /*mall_recommend*/ $(".mall_rec_tab li").hover(function(){ var _index = $(this).index(); tab($(".mall_rec_tab li"),$(".mall_rec_cont .recommend"),_index) }) /*detial_side nav*/ $(".details_nav li b").click(function(){ $(this).next().slideToggle().parent().toggleClass("active") }) $(".invest_group table tr:even").addClass("cf") $(".invest_group table tbody tr:even").addClass("cg") $(".invest_group .right tr:even").addClass("cf") $(".invest_group .right tr:odd").addClass("cg") /*services nav*/ $(".services li ").hover(function(){ var _index = $(this).index(); tab($(".services ul li"),$(".services .coments .cont"),_index) }) /**/ $(".details_zoushi_tab li ").click(function(){ var _index = $(this).index(); tab($(".details_zoushi_tab li"),$(".details_zoushi_map .cont"),_index) }) $(".details_tab ul li ").click(function(){ var _index = $(this).index(); tab($(".details_tab ul li"),$(".details .details_cont"),_index) }) }) //banner $(function() { var sWidth = $("#focus").width(); //获取焦点图的宽度(显示面积) var len = $("#focus ul li").length; //获取焦点图个数 var index = 0; var picTimer; $("#focus ul li").css({"width":sWidth}) var btn = "
"; for(var i=0; i < len; i++) { btn += ""; } btn += "
"; $("#focus").append(btn); $("#focus .btnBg").css("opacity",0.5); //为小按钮添加鼠标滑入事件,以显示相应的内容 $("#focus .btn span").css("opacity",1).mouseenter(function() { index = $("#focus .btn span").index(this); showPics(index); }).eq(0).trigger("mouseenter"); //上一页、下一页按钮透明度处理 $("#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); }); //本例为左右滚动,即所有li元素都是在同一排向左浮动,所以这里需要计算出外围ul元素的宽度 $("#focus ul").css("width",sWidth * (len)); //鼠标滑上焦点图时停止自动播放,滑出时开始自动播放 $("#focus").hover(function() { clearInterval(picTimer); },function() { picTimer = setInterval(function() { showPics(index); index++; if(index == len) {index = 0;} },4000); //此4000代表自动播放的间隔,单位:毫秒 }).trigger("mouseleave"); //显示图片函数,根据接收的index值显示相应的内容 function showPics(index) { //普通切换 var nowLeft = -index*sWidth; //根据index值计算ul元素的left值 $("#focus ul").stop(true,false).animate({"left":nowLeft},500); //通过animate()调整ul元素滚动到计算出的position //$("#focus .btn span").removeClass("on").eq(index).addClass("on"); //为当前的按钮切换到选中的效果 $("#focus .btn span").stop(true,false).css({"background":"#fff"}).eq(index).stop(true,false).css({"background":"#da0700"}); //为当前的按钮切换到选中的效果 } //nav var byx_w=$(".nav li.byx").width(); $(".nav li").css("width",(1024-byx_w)/($(".nav li").length-1)+"px") $(".nav li.byx").css("width",byx_w+"px"); });