﻿$(window).scroll(function(){
  if($(window).scrollTop() > 35){
      $("header").addClass('h_active');
    }else{
      $("header").removeClass('h_active');
    }
});

var e = false;
$(".icon-daohang").click(function(){
  $(".nav").toggle();
  if(e){
    $(this).attr('class','iconfont icon-daohang');
    e = false;
  }else{
    $(this).attr('class','iconfont icon-guanbi');
    e = true;
  };
});

if($(window).width()>980){
    $(".nav li").mouseenter(function(){
      $(this).find("dl").show();
    });
    $(".nav li").mouseleave(function(){
      $(this).find("dl").hide();
    });
  }else{
    $('.nav li').each(function(){
      if($(this).find('dl').size()){
        $(this).find('p a').attr('href','javascript:;')
      }
    });
    $(".nav li").click(function(){
      $(this).toggleClass('on').find("dl").toggle();
    });
  };

  $(".wenti li").click(function(){
    $(this).toggleClass('on').find(".box").slideToggle();
  });


var swiper = new Swiper('.banner', {
    centeredSlides: true,
    loop:true,
    autoplay: {
      delay: 5000,
      disableOnInteraction: false,
    },
    pagination: {
      el: '.swiper-pagination',
      clickable: true,
    },
});

var swiper = new Swiper('.index_pro', {
  slidesPerView: 2,
  spaceBetween: 30,
  autoplay: {
    delay: 5000,
    disableOnInteraction: false,
  },
  breakpoints:{ 
    980: {
      slidesPerView: 4,
    },
  },
});

var galleryThumbs = new Swiper('.gallery-thumbs', {
	slidesPerView: 'auto',
	direction: 'vertical',
	freeMode: true,
	watchSlidesVisibility: true,
	watchSlidesProgress: true,
  breakpoints:{ 
    860: {
      slidesPerView: 7,
    },
},
});
var galleryTop = new Swiper('.gallery-top', {
  loopedSlides: 1, 
  thumbs: {
    swiper: galleryThumbs,
  },
});

var swiper = new Swiper('.index_solutions', {
  slidesPerView: 2,
  spaceBetween: 10,
  navigation: {
    nextEl: '.nextyi',
    prevEl: '.prevyi',
  },
  breakpoints:{
    860: {
      slidesPerView: 4,
      spaceBetween: 30,
    },
  },
});

var swiper = new Swiper('.index_case', {
  slidesPerView: 3,
  spaceBetween: 30,
  pagination: {
    el: '.swiper-pagination',
    type: 'fraction',
  },
  navigation: {
    nextEl: '.nexter',
    prevEl: '.prever',
  },
});

var galleryThumbs = new Swiper('.gallery-thumbs-er', {
  spaceBetween: 20,
  slidesPerView: 2,
  freeMode: true,
  loopedSlides: 5,
  centerInsufficientSlides: true,
  watchSlidesVisibility: true,
  watchSlidesProgress: true,
});
var galleryTop = new Swiper('.gallery-top-er', {
  loopedSlides: 1, 
  thumbs: {
    swiper: galleryThumbs,
  },
});

var swiper = new Swiper('.zhengshu', {
  slidesPerView: 3,
  centeredSlides: true,
  loop: true,
  navigation: {
    nextEl: '.nextyi',
    prevEl: '.prevyi',
  },
});

var galleryThumbs = new Swiper('.gallery-thumbs-san', {
  spaceBetween: 10,
  slidesPerView: 2,
  freeMode: true,
  loopedSlides: 5,
  centerInsufficientSlides: true,
  watchSlidesVisibility: true,
  watchSlidesProgress: true,
  breakpoints:{ 
    860: {
      slidesPerView: 7,
    },
  },
});
var galleryTop = new Swiper('.gallery-top-san', {
  loopedSlides: 1, 
  effect: 'fade',
  thumbs: {
    swiper: galleryThumbs,
  },
});

var swiper = new Swiper('.news_list', {
  slidesPerView: 1,
  loop: true,
  autoplay: {
    delay: 5000,
    disableOnInteraction: false,
  },
  pagination: {
    el: '.swiper-pagination',
    clickable: true,
  },
});

var galleryThumbs = new Swiper('.gallery-thumbs_products', {
  spaceBetween: 10,
  slidesPerView: 6,
  freeMode: true,
  centerInsufficientSlides: true,
  watchSlidesVisibility: true,
  watchSlidesProgress: true,
});

var galleryTop = new Swiper('.gallery-top_products', {
  spaceBetween: 0,
  autoHeight:true,
  navigation: {
    nextEl: '.swiper-button-next',
    prevEl: '.swiper-button-prev',
  },
  thumbs: {
    swiper: galleryThumbs
  }
});

$(document).ready(function(){
  var a = false;
  $(".foot_right .box").click(function(){
    if(a){
      $(".foot_right .box p").css('transform','rotate(0deg)');
      a = false;
    }else{
      $(".foot_right .box p").css('transform','rotate(-180deg)');
      a = true;
    };
    $(".foot_right .box ul").toggle();
  });
});

var swiper = new Swiper('.picshi', {
  slidesPerView: 2,
  spaceBetween: 10,
  loop:true,
  autoplay: {
    delay: 5000,
    disableOnInteraction: false,
  },
  breakpoints:{ 
    980: {
      slidesPerView: 5,
      spaceBetween: 30,
    },
  },
});
