$(function() {

    function BrowserType() {
        var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
        var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
        var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
        var isEdge = userAgent.indexOf("Windows NT 6.1; Trident/7.0;") > -1 && !isIE; //判断是否IE的Edge浏览器

        if (isIE) {
            var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
            reIE.test(userAgent);
            var fIEVersion = parseFloat(RegExp["$1"]);
            if (fIEVersion < 9) {
                alert("浏览器版本过低，请升级或更换浏览器（谷歌、火狐等）")
                return false;
            } //IE版本过低
        } else {
            new WOW().init();
        }
        if (isEdge) {
            alert("浏览器版本过低，请升级或更换浏览器（谷歌、火狐等）")
            return false;
        } else {
            new WOW().init();
        }
    }
    BrowserType() // 浏览器是否为ie

    $(window).scroll(function() {
        if ($(window).scrollTop() > 1) {
            $(".top").addClass("fixed");
            $(".head-top").stop().addClass("fixed");
        } else {
            $(".top").stop().removeClass("fixed");
            $(".head-top").stop().removeClass("fixed");
        }
    })

    // pc 导航 展示 下拉
    $(".nav>ul>li").hover(function() {
        $(this).find(".after").stop().animate({
            "bottom": "0",
            "height": "15"
        }, 300);
        $(this).find(".before").stop().animate({
            "left": "0",
            "right": "0"
        }, 300);
        $(this).find(".item").css("visibility", "visible")
        $(this).find(".item").stop().animate({
            "opacity": "1",
        })
    }, function() {
        $(".nav>ul>li").find(".after").stop().animate({
            "bottom": "15",
            "height": "0"
        }, 300);
        $(".nav>ul>li").find(".before").stop().animate({
            "left": "50%",
            "right": "50%"
        }, 300);
        $(this).find(".item").stop().animate({
            "opacity": "0",
        })
        $(this).find(".item").css("visibility", "hidden")
    })


    // wap 导航 展示 下拉
    $(".menu").click(function() {
        $(".m-nav").animate({
            "left": "0"
        }, 300);
        $(this).hide()
        $(".close-menu").fadeIn();
        $("body").css("overflow", "hidden");
    })
    $(".close-menu").click(function() {
        $(".close-menu").fadeOut()
        $(".m-nav").animate({
            "left": "100%"
        }, 300);
        $(".menu").fadeIn();
        $("body").css("overflow", "auto");
    })
    $(".m-nav>ul>li>span").click(function() {
        $(this).toggleClass("on").parent().siblings("li").find("span").removeClass("on")
        $(this).siblings("ul").slideToggle().parent().siblings("li").find("ul").slideUp()
    })

    $(".ny-menu").click(function() {
        $(this).toggleClass("on");
        $(".ny-nav ul").slideToggle();
    })
})