$(function () {
    $(".secord-nav-box,.thrid-nav,.all-classify").mouseleave(function () {
        $('.thrid-nav,.secord-nav').hide();
    });
    $(".all-classify").mouseover(function () {
        $('.secord-nav').show();
    })

    window.onload = boxHeight();
    function boxHeight() {
        var boxH_0 = $('#one-moudle'),
            boxH_1 = $('#two-moudle'),
            boxH_2 = $('#three-moudle'),
            boxH_3 = $('#four-moudle'),
            boxH_4 = $("#five-moudle"),
            boxH_5 = $("#six-moudle"),
            boxH_6 = $("#seven-moudle"),
            boxH_7 = $("#eight-moudle");
        var nIndex = nav();
        $(".fixed-classify-secord span").on('click', function () {
            index = $(this).index();
            $('body,html').animate({
                scrollTop: eval(nIndex[index]).offset().top - 130 + 'px'
            }, 500)
        })
    };
    //返回boxH的数组
    function nav() {
        navArr = [];
        $(".fixed-classify-secord span").each(function (i, ele) {
            var nstr = 'boxH_' + i;
            navArr.push(nstr)
        })
        return navArr;
    }
    $(window).scroll(function(){
        var stp=$(window).scrollTop();
        for(var i=0; i<$(".classify-box").length ; i++){
            real = $(".classify-box").eq(i).offset().top-400;
            if(real<stp && stp>814){
                $(".fixed-classify-secord span").css("background-color","#1b1b1b").eq(i).css("background-color","#00b369");
            }
        }

        //if(stp<994 && stp>814){
        //    $(".fixed-classify-secord span").css("background-color","#1b1b1b").eq(0).css("background-color","#00b369");
        //}else if(stp<1528 && stp>814){
        //    $(".fixed-classify-secord span").css("background-color","#1b1b1b").eq(1).css("background-color","#00b369");
        //}else if(stp<2062 && stp>814){
        //    $(".fixed-classify-secord span").css("background-color","#1b1b1b").eq(2).css("background-color","#00b369");
        //}else if(stp<3132 && stp>814){
        //    $(".fixed-classify-secord span").css("background-color","#1b1b1b").eq(3).css("background-color","#00b369");
        //}else if(stp<3668 && stp>814){
        //    $(".fixed-classify-secord span").css("background-color","#1b1b1b").eq(4).css("background-color","#00b369");
        //}else if(stp<4161 &&　stp>814){
        //    $(".fixed-classify-secord span").css("background-color","#1b1b1b").eq(5).css("background-color","#00b369");
        //}else if()
    });


});

//左侧导航
$(document).scroll(function () {
    var scrollTop = $(document).scrollTop();
    if (scrollTop > 400) {
        $(".left-fixed-classify").css('display', 'block');

    } else {
        $(".left-fixed-classify").css('display', 'none');
    }
    // 浏览器宽度是笔记本的时候左侧不显示
    var widthWindow=($(window).width()); //浏览器时下窗口可视区域宽度
    if(widthWindow<1430){
        $(".left-fixed-classify").css("display","none");
    }
});


