// javascript document $(document).ready(function(){ var w=window.innerwidth || document.documentelement.clientwidth || document.body.clientwidth; var h=window.innerheight || document.documentelement.clientheight || document.body.clientheight; $(".indexbox").css({"height":h}); //菜单按钮点击效果 $(".navbtn").click(function(){ if(!$(this).hasclass("active")){ $(this).addclass("active"); $(".navbox nav").fadein(500); $(".navbox nav ul").animate({"right":0},500); }else{ $(this).removeclass("active"); $(".navbox nav").fadeout(500); $(".navbox nav ul").animate({"right":-300},500); } }); //点击显示弹出详情 $("li").click(function(){ var sctop=$(document).scrolltop(); if($(this).find(".fixedbox").length){ $("body").css({"position":"fixed","top":-sctop}); $(this).find(".fixedbox").fadein(500); $(".fixedboxright").animate({scrolltop:0},0); $(this).find(".fixedboxright").delay(500).animate({"right":0},500); } }); $(".fixedboxclose").click(function(e){ e?e.stoppropagation():event.cancelbubble = true; var sctopfix=parsefloat($("body").css("top")); $(".fixedbox").fadeout(0); $("body").css({"position":"static"}); $("html,body").animate({scrolltop:-sctopfix},0); $(".fixedboxright").css({"right":"-100%"}); }); //历史效果 var hisw=$(".historybox").width(); var hisl=$(".historytime dl dd").length; var hoi=1;//当前实际值 var hol=0;//左值 var hor=0;//右值 var holr=1;//左右值 var homaxh=function(){ var b=0; for(var g=0;gb){ b=$(".historything ul li").eq(g).height(); } } return b; }(); $(".historything").css({"height":homaxh}); $(".historything ul li").each(function(){ var thish=$(this).height(); $(this).css({"padding-top":(homaxh-thish)/2}) }); function honorstart(x){ $(".historytime dl").css({"width":hisl/x*100+"%","margin-left":-hisl/x/hisl*100+"%"}); $(".historytime dl dd").css({"width":1/hisl*100+"%"}); $(".historytime dl dd").eq(0).addclass("active"); $(".historything ul li").eq(0).css({"display":"block"}); $(".historytime dl dd").first().before($(".historytime dl dd").last()); $(".historything ul li").first().before($(".historything ul li").last()); } function honorright(x){ //控制文本 if(hoi>0){ hoi--; }else{ hoi=hisl-1; } $(".historything ul li").css({"display":"none"}).eq(hoi).css({"display":"block"}); //如果点了右 再点左 if(hor==1&&holr==x+1){ holr=holr-1; } if(holr>0){ holr-- }else{ holr=0 } //点击时 >> 为中间显示切换时 >> 没到最右时 当左右差值小于等于7时 if(holr>=1){ $(".historytime dl dd").removeclass("active").eq(holr).addclass("active"); $(".historything ul li").css({"display":"none"}).eq(holr).css({"display":"block"}); } if(holr<1){ //点击左 >> 无缝 只关系最左边(当在最左时) $(".historytime dl dd").removeclass("active").eq(0).addclass("active"); //无缝 $(".historytime dl").animate({"margin-left":0},500,function(){ $(".historytime dl").css({"margin-left":-hisl/x/hisl*100+"%"}); $(".historytime dl dd").first().before($(".historytime dl dd").last()); }); } hol=1; hor=0; } function honorleft(x){ //控制文本 if(hoix){ //点击右 >> 无缝 只关系最右边(当在最右时) $(".historytime dl dd").removeclass("active").eq(x+1).addclass("active"); //无缝 $(".historytime dl").animate({"margin-left":-2*hisl/x/hisl*100+"%"},500,function(){ $(".historytime dl").css({"margin-left":-hisl/x/hisl*100+"%"}); $(".historytime dl dd").last().after($(".historytime dl dd").first()); }); } hol=0; hor=1; } function honorpc(x){ honorstart(x); //点击左按钮 $(".historybtn span.prev").click(function(){ honorright(x); }); //点击右按钮 $(".historybtn span.next").click(function(){ honorleft(x); }); } function honormc(x){ honorstart(x); //点击左按钮 $(".historybtn span.prev").click(function(){ honorright(x); }); $(".historything").hammer().on("swiperight",function(){ honorright(x); }); //点击右按钮 $(".historybtn span.next").click(function(){ honorleft(x); }); $(".historything").hammer().on("swipeleft",function(){ honorleft(x); }); } if(w>767){ honorpc(7); } if(w<=767){ $(".historybtn").appendto($(".historything")); honormc(4); } //公司环境切换 $(".hjimgbox ul li").each(function(){ var _this=$(this); var hjl=_this.find("dd").length-1; var i=0; _this.find("dd").eq(0).css({"display":"block"}); //点击切换 _this.find(".rbtn").click(function(){ if(i0){ i--; }else{ i=hjl; } _this.find("dd").fadeout(500).eq(i).fadein(500); }); //滑屏切换 _this.hammer().on("swiperight",function(){ if(i0){ i--; }else{ i=hjl; } _this.find("dd").fadeout(500).eq(i).fadein(500); }); }); //如果html高度小于屏幕 则页脚定位到底部 console.log($("body").height()+","+h); function footercheck(){ var bh=$("body").height() console.log(bh+","+h) if(bh){ if(bh