/* 
* @Author: anchen
* @Date:   2015-07-29 09:44:13
* @Last Modified by:   anchen
* @Last Modified time: 2015-10-22 09:18:20
*/
/*banner轮播*/
$(document).ready(function(){

     /*轮播开始*/
     
      var $key=0;
      var $circle=0;
      var speed=500;
  //先做右侧点击滚动
  var timer=setInterval(autoplay,5000);

  function autoplay(){
    $key++;
    if($key>6){
      $key=1;
      $(".banner ul").css({"left":0});
    }
    $(".banner ul").stop().animate({"left":-$key* 100+'%'}, speed);

    $circle++;
    if($circle>5){
      $circle=0;
    }
    $(".banner-box ol li").eq($circle).addClass('current').siblings().removeClass('current');
  };

   $(".banner-box ol li").hover(function() {
     $key=$(this).index();
      $circle=$(this).index();
      $(".banner ul").stop().animate({"left":-$key* 100+'%'}, speed);
      $(".banner-box  ol li").eq($circle).addClass('current').siblings().removeClass('current');
       clearInterval(timer);
   }, function() {
       clearInterval(timer);/*启动定时器之前会先清除一下定时器，个人经验*/
          timer=setInterval(autoplay, 5000);
   });

  $(".banner").hover(function() {
        clearInterval(timer);
      }, function() {
        clearInterval(timer);/*启动定时器之前会先清除一下定时器，个人经验*/
        timer=setInterval(autoplay, 5000);
      });

   /*  banner下方的内容旋转的效果*/
         var banRtion=[[".banner_info_grade",".icon_rotate_grade"],[".banner_info_content",".icon_rotate_content"],[".banner_info_function",".icon_rotate_function"]] 
    $.each(banRtion,function(index, el) {
          $(el[0]).hover(function() {
            $(el[1]).css('transform','rotate(360deg)');
          }, function() {
            $(el[1]).css('transform','rotate(0deg)');
          });
    });


      /*  我们的产品部分的效果*/
   $(".pro-main ul li").hover(function() {
          $(this).children('#animate').show();
      }, function() {
           $(this).children('#animate').hide();
      });
 $("#animate-shop").hover(function() {
          $(this).children('.shop-hover').show();
      }, function() {
           $(this).children('.shop-hover').hide();
      });

    /*点击进入的颜色变化*/
      var ckCo=[[".first span","#27a4d7"],[".two span","#5896cc"],[".three span","#ff6951"],[".four span","#00c4a0"],[".five span","#bbbbbb"],[".six span","#8fc31f"]]
    $.each(ckCo,function(index, el) {
          $(el[0]).hover(function() {
              $(this).children().css("color","#fff")
           }, function() {
             $(this).children().css("color",el[1])
          });
    });

});

