$(window).scroll(function(){
  var top2=$(window).scrollTop();
  var wid=$(window).width();
  if(top2>200){
  $(".bottom-index-fixed").addClass('show1')
  }else{
    $(".bottom-index-fixed").removeClass('show1')  
  }
  if(wid>1024){

  if(top2>20){
    $("header").addClass("on-header")
  }else{
    $("header").removeClass("on-header")
  }
  }else{
      $("header").removeClass("on-header")
  }
})
var flag=true;
var SwiperBanner = {
  indexBanner:function(){
    var indexBanner = new Swiper('.index-banner .swiper1', {
      effect: 'fade',
      speed: 900,
      loop: true,
      deplay: 8000,
      autoplay:true,
      navigation: {
        nextEl: '.index-banner .swiper-button-next',
        prevEl: '.index-banner .swiper-button-prev',
      },
      pagination: {
        el: '.index-banner .swiper-pagination',
        clickable: 'true',
      },
    })
    var indexPro = new Swiper('.index-pro .swiper2', {
      slidesPerView:'1',
      loop:'true',
      spaceBetween: 20,
      speed: 600,
      navigation: {
        nextEl: '.index-pro .swiper-button-next',
        prevEl: '.index-pro .swiper-button-prev',
      },
      breakpoints: { 
        540:{
          slidesPerView:'2',
        },
        768:{
          slidesPerView:'3',
        },
        1200:{
          slidesPerView:'4',
        }
     }
    })
  },
  init:function(){
    this.indexBanner();
  }
}
var indexCustomer = {
    customer:function(){
      $('.index-customer .customer-lists ul li').hover(function(){
        $(this).addClass('customer-active').siblings('li').removeClass('customer-active');
      })
    },
    customerSwp:function(){
      var indexCusomer = new Swiper('.index-customer .swiper3', {
        slidesPerView:'1',
        loop:'true',
        spaceBetween: 20,
        speed: 600,
        navigation: {
          nextEl: '.index-customer .swiper-button-next',
          prevEl: '.index-customer .swiper-button-prev',
        },
      })
    },
    init:function(){
      this.customer();
      this.customerSwp();
    }
}
 

var indexPro = {
    StrText:function(){
      if($(window).width()< 433){
        $('.index-pro .swiper-main .swiper-slide a .pro-txt .pro-c').each(function(){
          $(this).text($(this).text().substring(0, 80) + '...');
        })
      }
    },
    init:function(){
      this.StrText();
    }
}
$(function(){
    indexPro.init();
    SwiperBanner.init();
    indexCustomer.init();
    var wow = new WOW({
		boxClass: 'wow',
		animateClass: 'animated',
		offset: 0,
		mobile: true,
		live: true
    });
    wow.init();
})