//banner
function banner(obj1){
var obj1=obj1;//传入参数
var obj=new object;
obj.nowindex=0;//banner切换的序号
obj.interval="";//banner切换计时器
obj.banner=obj1.banner;//banner框架
obj.btn=obj1.btn;//banner按钮框架
obj.btnurl=obj1.btnurl;//按钮路径
obj.bool=obj1.bool||true;//判断切换
obj.btnurlon=obj1.btnurlon;//按钮被点击路径
obj.getmun=function(){//获取banner个数
var mun=$(obj.banner).length-1;
return mun;
}
obj.mun=0;//banner个数
//添加按钮
obj.btnappend=function(){
$(obj.banner).not($(obj.banner+":eq(0)")).stop(false,true).hide();
$(obj.banner+":eq(0) .title1").css({"opacity":1});
$(obj.banner+":eq(0) .title2").css({"opacity":1});
$(obj.banner+":eq(0) .title3").css({"opacity":1});
$(obj.banner+":eq(0)").show();
$(obj.btn).append("");
for(var i=1;i<=obj.mun;i++){
$(this.btn).append("");
}
}
//确定哪个为白色
obj.btnposition=function(btnindex){
$(obj.btn+">img").attr("src",obj.btnurl);
$(obj.btn+">img:eq("+btnindex+")").attr("src",obj.btnurlon);
}
//切换事件
obj.bannerdo=function(btnindex){
$(obj.banner+":eq("+obj.nowindex+") .title1").stop(true,true).animate({"opacity":0},1200);
$(obj.banner+":eq("+obj.nowindex+") .title2").stop(true,true).delay(200).animate({"opacity":0},1200);
$(obj.banner+":eq("+obj.nowindex+") .title3").stop(true,true).delay(400).animate({"opacity":0},1000);
$(obj.banner+":eq("+obj.nowindex+")").stop(true,true).delay(600).fadeout(500);
if(btnindex||btnindex==0){
obj.nowindex=btnindex;
}else{
obj.nowindex==obj.mun?obj.nowindex=0:obj.nowindex++;
}
obj.btnposition(obj.nowindex);
$(obj.banner+":eq("+obj.nowindex+")").stop(true,true).delay(600).fadein(500);
$(obj.banner+":eq("+obj.nowindex+") .title1").stop(true,true).delay(800).animate({"opacity":1},1200);
$(obj.banner+":eq("+obj.nowindex+") .title2").stop(true,true).delay(1000).animate({"opacity":1},1200);
$(obj.banner+":eq("+obj.nowindex+") .title3").stop(true,true).delay(1200).animate({"opacity":1},1000);
}
return obj;
}
// banner over
var banner1=new banner({
banner:".banner .contents .content",
btn:".bannernav",
btnurl:"/public/images/index/bannerbtn.jpg",
btnurlon:"/public/images/index/bannerbtnon.jpg"
});
//白点被点击
function bannerbtnclick(btnindex){
if(btnindex=="-"){
banner1.nowindex==0?btnindex=banner1.mun:btnindex=banner1.nowindex-1;
}else if(btnindex=="+"){
banner1.nowindex==banner1.mun?btnindex=0:btnindex=banner1.nowindex+1;
}
clearinterval(banner1.interval);
banner1.bannerdo(btnindex);
banner1.btnposition(btnindex);
banner1.interval=setinterval(function(){
banner1.bannerdo(null);
},3000);
}
/*main change*/
function mainchange(obj1){
var obj1=obj1;//传入参数
var obj=new object;
obj.nowindex=0;//序号
obj.lastindex=0;//序号
obj.childsdiv=obj1.childsdiv;//父框架
obj.childdiv=obj1.childdiv;//框架
obj.btndiv=obj1.btndiv;//按钮框架
obj.btnevent=obj1.btnevent;//按钮事件
obj.getmun=function(){//获取个数
var mun=$(obj.childdiv).length-1;
return mun;
}
obj.getwidth=function(){//获取框架宽度
var childwidth=$(obj.childdiv).width();
return childwidth;
}
obj.childwidth=0//框架宽度
obj.mun=0;//个数
//添加按钮
obj.btnappend=function(){
//$(obj.btndiv).append('');
//for(var i=1;i<=obj.mun;i++){
//$(obj.childdiv+":eq("+i+")").css("left",i*obj.childwidth+"px");
//$(obj.btndiv).append('');
//}
$(obj.childdiv).not($(obj.childdiv+":eq("+obj.nowindex+")")).css("left",-obj.childwidth+"px");
$(obj.childdiv+":eq("+obj.mun+")").css("left",obj.childwidth+"px");
$(obj.childdiv+":eq("+obj.nowindex+")").css("left","0px");
}
//切换事件
obj.bannerdo=function(btnindex,direction){
obj.childwidth=obj.getwidth();
//$(obj.childdiv+":eq("+obj.nowindex+")").stop(false,true).animate({"left":"0px"},500);
direction=="+"?direction="-":direction="+";
var a=direction+obj.childwidth+"px";
$(obj.childdiv+":eq("+obj.nowindex+")").stop(false,true).animate({"left":a},500);
if(btnindex||btnindex==0){
obj.nowindex=btnindex;
}else{
obj.nowindex==obj.mun?obj.nowindex=0:obj.nowindex++;
}
direction=="+"?direction="-":direction="+";
a=direction+obj.childwidth+"px";
$(obj.childdiv+":eq("+obj.nowindex+")").css("left",a);
$(obj.childdiv+":eq("+obj.nowindex+")").stop(false,true).animate({"left":"0"},500);
//$(obj.childsdiv).stop(false,true).animate({"left":"-"+obj.nowindex*obj.childwidth+"px"},500);
}
return obj;
}
function customerbtnclick(btnindex){
customer.lastindex=customer.nowindex;
if(btnindex=="-"){
customer.nowindex==0?btnindex=customer.mun:btnindex=customer.nowindex-1;
customer.bannerdo(btnindex,"-");
}else if(btnindex=="+"){
customer.nowindex==customer.mun?btnindex=0:btnindex=customer.nowindex+1;
customer.bannerdo(btnindex,"+");
}
}
var customer=new mainchange({
childsdiv:".customer .contentss",
childdiv:".customer .contentss .content",
btnevent:"customerbtnclick"
});
$(function(){
/*banner*/
banner1.mun=banner1.getmun();
banner1.btnappend();
banner1.interval=setinterval(function(){
banner1.bannerdo(null);
},3000);
$(".banner").mouseover(function(){
clearinterval(banner1.interval);
$(this).find(".bannerbtn.leftbtn").animate({"left":"30px"},300);
$(this).find(".bannerbtn.rightbtn").animate({"right":"30px"},300);
}).mouseleave(function(){
banner1.interval=setinterval(function(){
banner1.bannerdo(null);
},3000);
$(this).find(".bannerbtn.leftbtn").stop(false,true).animate({"left":"-100px"},300);
$(this).find(".bannerbtn.rightbtn").stop(false,true).animate({"right":"-100px"},300);
});
/*customer*/
customer.mun=customer.getmun();
customer.childwidth=customer.getwidth();
customer.btnappend();
/*work*/
$(".work .child").mouseover(function(){
$(".work .child").not($(this)).find(".childhide").stop(false,true).fadeout(500);
$(this).find(".childhide").fadein(500);
}).mouseleave(function(){
$(this).find(".childhide").stop(false,false).fadeout(500);
});
/*service*/
$(".service .child").mouseover(function(){
$(this).find(".childtitle").css("background","#e60012");
$(this).find(".titlech").css("color","#fff");
$(this).find(".titleen").css("color","#fff");
}).mouseleave(function(){
$(this).find(".childtitle").css("background","#fff");
$(this).find(".titlech").css("color","#444");
$(this).find(".titleen").css("color","#e50012");
});
});
var loghandle = function(event, delta) {
var scrolltop=$(document).scrolltop();
return scrolltop+event.deltay*event.deltafactor;
};
window.onload=function(){
var screenheight=$(window).height();
var scrolls={};
var scrollname=['.about','.work','.customer','.say','.advantage','.team','.service','.news'];
var scrollbool=[false,false,false,false,false,false,false,false];
for(var i=0;i 280 && $(window).scrolltop() < 300){
$(".about .child:eq(0) span").html(0);
$(".about .child:eq(1) span").html(0);
$(".about .child:eq(2) span").html(10);
var i1=0;
var i2=0;
var i3=10;
settimeout(function(){
var child1=setinterval(function(){
i1=i1+10;
if(i1>=2000)clearinterval(child1);
$(".about .child:eq(0) span").html(i1);
},12);
var child2=setinterval(function(){
++i2;
if(i2>=19)clearinterval(child2);
$(".about .child:eq(1) span").html(i2);
},100);
var child3=setinterval(function(){
i3=i3-1;
if(i3<=0)clearinterval(child3);
$(".about .child:eq(2) span").html(i3);
},12);
},500);
}
});