$(function(){
var swiper = new swiper('.swiper-container', {
pagination: '.swiper-pagination',
direction: 'vertical',
slidesperview: 1,
spacebetween: 30,
mousewheelcontrol: true,
pagination: '.swiper-pagination',
paginationclickable: true,
paginationtype: 'custom',
paginationcustomrender: function(swiper, current, total) {
var custompaginationhtml = "";
for(var i = 0; i < total; i++) {
//判断哪个分页器此刻应该被激活
if(i == (current - 1)) {
custompaginationhtml += '';
} else {
custompaginationhtml += '';
}
}
return custompaginationhtml;
},
onslidechangestart: function(swiper){
var index = swiper.activeindex;
console.log(index);
removesecond();
removethird();
removefourth();
removefive();
removesix();
if(index==0){
$(".ico.ico-search-white").removeclass("grey");
$(".home-head .text").removeclass("current");
$(".home-head .logo").find("img").attr('src','img/logo-white.png');
$(".home-head .menu").css('color','#fff');
}else if(index==1){
$(".ico.ico-search-white").addclass("grey");
$(".home-head .text").addclass("current");
$(".home-head .logo").find("img").attr('src','img/logo.png');
$(".home-head .menu").css('color','#646464');
animatesecond();
}else if(index==2){
animatethird();
$(".ico.ico-search-white").removeclass("grey");
$(".home-head .text").removeclass("current");
$(".home-head .logo").find("img").attr('src','img/logo-white.png')
$(".home-head .menu").css('color','#fff');
}else if(index==3){
animatefourth();
$(".ico.ico-search-white").addclass("grey");
$(".home-head .text").addclass("current");
$(".home-head .logo").find("img").attr('src','img/logo.png');
$(".home-head .menu").css('color','#646464');
}else if(index==4){
animatefive();
$(".ico.ico-search-white").addclass("grey");
$(".home-head .text").addclass("current");
$(".home-head .logo").find("img").attr('src','img/logo.png');
$(".home-head .menu").css('color','#646464');
}else if(index==5){
animatesix();
$(".ico.ico-search-white").removeclass("grey");
$(".home-head .text").removeclass("current");
$(".home-head .logo").find("img").attr('src','img/logo-white.png');
$(".home-head .menu").css('color','#fff');
}
}
});
$(".swiper-pagination").on("click","span",function(){
var index = $(this).index();
swiper.slideto(index);
})
//banner
jquery(".banner").slide({
maincell:".banner-wrap ul",
effect:"fold",
autoplay:true,
intertime:3000,
endfun:function(i,c,s){
removethree();
removeone();
removetwo();
if(i==0){
animateone();
}else if(i==1){
animatetwo();
}else{
animatethree()
}
},
// startfun:function(i){
// $(".home-slide").find('li img').eq(i).addclass("animated bouncein");
// }
});
$(".banner").fullimages({
imgwidth: 1920,
imgheight: 860,
})
//侧边导航
$(".home-side-nav .side-nav").find(".item").hover(function(){
var index = $(this).index();
$(".drop-wrap").addclass('open');
$(this).addclass("current").siblings().removeclass("current");
if(index==1){
$(".drop-wrap").find(".drop-list").eq(0).removeclass("hidden").siblings().addclass("hidden");
}else if(index==3){
$(".drop-wrap").find(".drop-list").eq(1).removeclass("hidden").siblings().addclass("hidden");
}else if(index==4){
$(".drop-wrap").find(".drop-list").eq(2).removeclass("hidden").siblings().addclass("hidden");
}else if(index==5){
$(".drop-wrap").find(".drop-list").eq(3).removeclass("hidden").siblings().addclass("hidden");
}else{
$(".drop-wrap").removeclass('open');
}
});
$(".drop-list").find(".item").hover(function(){
$(".drop-wrap").addclass('open');
},function(){
$(".drop-wrap").removeclass('open');
});
//展开侧边栏
$(".js-menu-open").hover(function(){
$(".home-side-nav").addclass("open");
});
//关闭侧边栏
$(".js-menu-close").click(function(){
$(".home-side-nav").removeclass("open");
});
//第三屏
var w_h = parsefloat($(window).height()),
i_h = parsefloat(w_h/2);
$(".home-product").find(".item").css('height',i_h+'px')
});
function animateone(){
$(".one-title").animate({'top':'35%','opacity':'1'},1000);
$(".one-font").delay(100).animate({'top':'36%','opacity':'1'},1000);
}
function removeone(){
$(".one-title").animate({'top':'30%','opacity':'0'},1000);
$(".one-font").delay(100).animate({'top':'40%','opacity':'0'},1000);
}
function animatetwo(){
$(".two-title").animate({'opacity':'1'},300).addclass("pullinleft");
$(".two-font").delay(400).animate({'opacity':'1'},1000);
}
function removetwo(){
$(".two-title").animate({'opacity':'0'},100).removeclass("pullinleft");
$(".two-font").delay(100).animate({'opacity':'0'},1000);
}
function animatethree(){
$(".three-title").animate({'opacity':'1'},300).addclass("zoominsmall");
$(".three-font").delay(100).animate({'margintop':'30px','opacity':'1'},1000);
}
function removethree(){
$(".three-title").animate({'opacity':'0'},100).removeclass("zoominsmall");
$(".three-font").delay(100).animate({'margintop':'50px','opacity':'0'},1000);
}
function animatesecond(){
$(".home-two").find(".left").addclass("fadeinleft");
$(".home-two").find(".font").addclass("fadeinright");
$(".home-two").find(".title").addclass("fadeinup").css('animationdelay','.6s');
$(".home-two").find(".text").addclass("fadein").css('animationdelay','1s');
$(".home-two").find(".more-btn").addclass("zoominsmall").css('animationdelay','1.5s');
}
function removesecond(){
$(".home-two").find(".left").removeclass("fadeinleft");
$(".home-two").find(".font").removeclass("fadeinright");
$(".home-two").find(".title").removeclass("fadeinup").removeattr('style');
$(".home-two").find(".text").removeclass("fadein").removeattr('style');
$(".home-two").find(".more-btn").removeclass("zoominsmall").removeattr('style');
}
function animatethird(){
$(".home-product .item").each(function(index,element){
$(".home-product .item").eq(index).addclass("animated pullinhorizontal").css('animationdelay',.4*(index+1)+'s');
});
}
function removethird(){
$(".home-product .item").each(function(index,element){
$(".home-product .item").eq(index).removeclass("animated pullinhorizontal").css('animationdelay','0s');
});
}
function animatefourth(){
$(".home-news .item").each(function(index,element){
$(".home-news .item").eq(index).addclass("animated fadeinup").css('animationdelay',.4*(index+1)+'s');
});
}
function removefourth(){
$(".home-news .item").each(function(index,element){
$(".home-news .item").eq(index).removeclass("animated fadeinup").removeattr('style');
});
}
function animatefive(){
$(".home-five").find(".title").addclass("zoominsmall");
$(".home-five").find(".ico-five").addclass("fadein").css('animationdelay','.4s');
$(".map .item").each(function(index,element){
$(".map .item").eq(index).addclass("animated fadein").css('animationdelay',.6*(index+1)+'s');
});
}
function removefive(){
$(".home-five").find(".title").removeclass("zoominsmall");
$(".home-five").find(".ico-five").removeclass("fadein").removeattr('style');
$(".map .item").each(function(index,element){
$(".map .item").eq(index).removeclass("animated fadein").removeattr('style');
});
}
function animatesix(){
$(".home-six").find(".roud").addclass("turn");
$(".home-six").find(".logo").addclass("zoominsmall");
$(".six-list .item").each(function(index,element){
$(".six-list .item").eq(index).addclass("animated fadein").css('animationdelay',.6*(index+1)+'s');
});
}
function removesix(){
$(".home-six").find(".roud").removeclass("turn");
$(".home-six").find(".logo").removeclass("zoominsmall");
$(".six-list .item").each(function(index,element){
$(".six-list .item").eq(index).removeclass("animated fadein").removeattr('style');
});
}