// OwlCarousel轮播
$('.index .sec1 .owl-carousel').owlCarousel({
    loop:true,
    items:1,
    margin:0,
    nav:false,
    dots:true,
    autoplay:true,
    autoplayTimeout:21000,
    autoplayHoverPause:true,
    smartSpeed:1000,
	//autoHeight: true,
})

$('.index .sec3 .owl-carousel').owlCarousel({
    loop:true,
    nav:true,
    dots:true,
    dotsEach: 1,
    autoplay:true,
    autoplayTimeout:5000,
    autoplayHoverPause:true,
    smartSpeed:1000,
    responsive:{
        0:{
            items:1,
            margin:15,
        },
        1024: {
            items:2,
            margin:20,
        }
    }
})

// 定义Swiper轮播变量
var slider_num = 5,
    effect_way = 'fade';
if($(window).width()<1024) slider_num = 4;
if($(window).width()<640) slider_num = 3,effect_way = 'slide';
if($(window).width()<480) slider_num = 2;

// Swiper轮播
var galleryThumbs = new Swiper('.gallery-thumbs', {
    spaceBetween: 10,
      loop: true,
    slidesPerView: slider_num,
    watchSlidesVisibility: true,
    watchSlidesProgress: true,
});

var galleryTop = new Swiper('.gallery-top', {
    spaceBetween: 0,
	//cssMode:true,
      loop: true,
	effect : 'fade',
    autoplay: {
        delay: 6000,//6秒切换一次
    },
    pagination: {
        el: '.pagers',
        clickable :true,
    },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    thumbs: {
        swiper: galleryThumbs
    }
});


$(".sec6").each(function(){
    var e=$(this).index()-4
    var big=".slider-big"+e+""
    var nav=".slider-small"+e+" .slider"
    //console.log(big)
    $(big).slick({
        asNavFor: nav,
        //infinite: false,
        dots: true,
        autoplay: true,
              fade: true,
        autoplaySpeed: 6000,
    });
    $(nav).slick({
        slidesToShow: 5,
        asNavFor:big,
        //infinite: false,
        arrows: false,
        vertical: true,
                useCSS: false,
        focusOnSelect: true
    });
    $(big).on('afterChange', function(event, slick, currentSlide, nextSlide){
        // console.log(nextSlide);
        $(big).find("li").eq(currentSlide).siblings().removeClass("ani-show");
        $(big).find("li").eq(currentSlide).addClass("ani-show");
    });
//初始
    $(this).find(".slick-arrow").appendTo($(this).find(".slider-small"));
    $(this).find(".slider-big li").eq(0).addClass("ani-show");
});

// 搜索一
$("#SecBtn1").jqSearch({
    TxtVal: "智能坐便器/浴室柜/花洒/瓷砖/家居定制",
    KeyTxt1: "输入产品名称搜索！",
    KeyTxt2: "输入的位置字数不要过多！",
    KeyTxt3: "您输入的内容存在特殊字符！",
    KeyId: "SecKey1", //输入框id
    KeyUrl: Sec1path, //跳转链接
    KeyHref: "key", //链接传值
    Static: false //是否静态站
});

//移动端门店信息搜索
$("#storeBtnwap").jqSearch({
    TxtVal: "输入您所在的位置",
    KeyTxt1: "输入您所在位置搜索！",
    KeyTxt2: "输入的位置字数不要过多！",
    KeyTxt3: "您输入的内容存在特殊字符！",
    KeyId: "storekeywap", //输入框id
    KeyUrl: storewappath, //跳转链接
    KeyHref: "key", //链接传值
    Static: false //是否静态站
});
//

//全新产品
$("#hBtn1").jqSearch({
    TxtVal: "搜索智能马桶",
    KeyTxt1: "输入关键词搜索！",
    KeyTxt2: "输入的关键词字数不要过多！",
    KeyTxt3: "您输入的内容存在特殊字符！",
    KeyId: "hKey1", //输入框id
    KeyUrl: hs1path, //跳转链接
    KeyHref: "key", //链接传值
    Static: false //是否静态站
});


$('.sec2 .slider').slick({
    slidesToShow: 3,
    slidesToScroll: 3,
    arrows: true,
    infinite: false,
    dots: false,
    //autoplay:true,
    responsive: [
        {
            breakpoint: 1024,
            settings: {slidesToShow: 2,slidesToScroll: 1,}
        },
        {
            breakpoint: 750,
            settings: {slidesToShow: 1,slidesToScroll: 1,}
        }
    ]
});


	var timersec2 = null;
$(".index .sec2 .ul li").hover(function () {
    var e=$(this).index();
		timersec2 = setTimeout(function(){
				$(".img-big_con").addClass("img-big_conshow")
				$(".img-big_con .img").eq(e).addClass("img-show");				
		        },1000);
				$(".img-big_con .img").removeClass("img-show");
			},function(){
				clearTimeout(timersec2);
		});
$(".img-big_con .img").mouseleave(function(){
    $(".img-big_con").removeClass("img-big_conshow")
    $(".img-big_con .img").removeClass("img-show");
});

$(".btn-buy").hover(function(){
    $(this).find("figure").stop(true,true).fadeIn();
},function(){
    $(this).find("figure").stop(true,true).fadeOut();
});




//热销精选
$("#hBtn2").jqSearch({
    TxtVal: "搜索箭牌瓷砖",
    KeyTxt1: "输入关键词搜索！",
    KeyTxt2: "输入的关键词字数不要过多！",
    KeyTxt3: "您输入的内容存在特殊字符！",
    KeyId: "hKey2", //输入框id
    KeyUrl: hs2path, //跳转链接
    KeyHref: "key", //链接传值
    Static: false //是否静态站
});

//空间定制
$("#hBtn3").jqSearch({
    TxtVal: "搜索更多家居定制产品",
    KeyTxt1: "输入关键词搜索！",
    KeyTxt2: "输入的关键词字数不要过多！",
    KeyTxt3: "您输入的内容存在特殊字符！",
    KeyId: "hKey3", //输入框id
    KeyUrl: hs3path, //跳转链接
    KeyHref: "key", //链接传值
    Static: false //是否静态站
});

//当季推荐卫浴
$("#hBtn4").jqSearch({
    TxtVal: "搜索更多卫浴产品",
    KeyTxt1: "输入关键词搜索！",
    KeyTxt2: "输入的关键词字数不要过多！",
    KeyTxt3: "您输入的内容存在特殊字符！",
    KeyId: "hKey4", //输入框id
    KeyUrl: hs4path, //跳转链接
    KeyHref: "key", //链接传值
    Static: false //是否静态站
});

//瓷砖
$("#hBtn5").jqSearch({
    TxtVal: "搜索更多瓷砖产品",
    KeyTxt1: "输入关键词搜索！",
    KeyTxt2: "输入的关键词字数不要过多！",
    KeyTxt3: "您输入的内容存在特殊字符！",
    KeyId: "hKey5", //输入框id
    KeyUrl: hs5path, //跳转链接
    KeyHref: "key", //链接传值
    Static: false //是否静态站
});

$(".hasbuy").each(function(){
	var e=$(this).find("figure").find("a").length; 
    if(e==1){
        $(this).find("figure").addClass("Yigea")
    }
	if(e==0){
	   $(this).hide();
	   $(this).next(".nobuy").show();
    }
});



