var w = $("body").width(); var h = $(window).height(); var isIe8 = false; var browser = navigator.appName var b_version = navigator.appVersion var version = b_version.split(";"); var trim_Version = version[1].replace(/[ ]/g, ""); var award = null; var team = null; var cur = -1; if (browser == "Microsoft Internet Explorer" && trim_Version == "MSIE8.0") { isIe8 = true; } window.onresize = function() { w = $("body").width(); init(); }; function init() { setIE8(); var setTop = function(n) { var sTop = 20; if(w<1024){ sTop = 60; }else if(w<1366){ sTop = 50; }else if(w<1920){ sTop = 20; } var stopTop = $("#" + (n + 1)).offset().top - sTop; $("html,body").stop(true, false).animate({ scrollTop: stopTop }, 300, "linear", function() { }); }; $('body').on('click',function (e) { var obj = $(e.target); if(w<768 && obj.closest(".h-menu").length < 1){ $(".h-menu-content span").removeClass("bm"); $(".h-menu-content ul").slideUp(); } }); $(".h-menu-content a").unbind("click").bind("click", function() { var n = $(this).parent().parent().find("a").index(this); if(w<768){ if(n>=3)return; $(".h-menu-content span").removeClass("bm"); $(".h-menu-content ul").slideUp(); } setTop(n); }); /*$(".h-menu-middle a").unbind("click").bind("click", function() { var n = $(".h-menu-middle a").index(this); setTop(n); });*/ $(".h-menu-content span").unbind("click").bind("click", function() { if($(this).hasClass("bm")){ $(".h-menu-content span").removeClass("bm"); $(".h-menu-content ul").slideUp(); }else{ $(".h-menu-content span").addClass("bm"); $(".h-menu-content ul").slideDown(); } }); $(window).bind("scroll", function() { var top = $(window).scrollTop(); var middleMenuTop = $("#middleMenu").offset().top; var headerHeight = $("header").height(); //var menuHeight = $(".h-menu-top").height(); if (top > ($("#3").offset().top - 0.5*h)) { cur = 2; } else if (top > ($("#2").offset().top - 0.5*h)) { cur = 1; } else if (top > ($("#1").offset().top - 0.5*h)) { cur = 0; } else { cur = -1; } $(".h-menu-top a.active").removeClass("active"); $(".h-menu-middle a.active").removeClass("active"); if (cur >= 0){ $(".h-menu-top a.active").removeClass("active"); $(".h-menu-top a").eq(cur).addClass("active"); $(".h-menu-middle a.active").removeClass("active"); $(".h-menu-middle a").eq(cur).addClass("active"); } if (top+headerHeight > middleMenuTop) { if(!$("#middleMenu").hasClass("opacity")){ $("#middleMenu").addClass("opacity"); $("header").stop(true, false).animate({ top: -1*headerHeight }, 200, "linear", function() { $(".h-menu-top").addClass("h-menu-top-show"); }); } }else{ if($("#middleMenu").hasClass("opacity")){ $("#middleMenu").removeClass("opacity"); $("header").stop(true, false).animate({ top: 0 }, 300, "linear", function() {}); $(".h-menu-top").removeClass("h-menu-top-show"); } } }); /*$(".video-view").unbind("click").bind("click", function() { var url = $(this).data("v"); var vhtml = ''; if (url == "") return; $(".h-video-content").html(vhtml); $(".h-video-box").removeClass("hide"); $(".h-video-box").unbind("click").bind("click", function() { $(".h-video-box").addClass("hide"); $(".h-video-content").html(""); }) $(".btn-close").unbind("click").bind("click", function() { $(".h-video-box").addClass("hide"); $(".h-video-content").html(""); }) $(".h-video").unbind("click").bind("click", function(e) { e.stopPropagation(); //阻止点击事件向上冒泡 }) })*/ if (award == null) { award = new Swiper('.h-award-container', { loop: true, autoplay: true, spaceBetween: 20, pagination: { el: '.swiper-pagination-award', clickable: true, } }); } //视频自动播放取消静音 /*$("body").unbind("click").bind("click",function() { document.getElementById("aolinpa").muted = false; })*/ } function setIE8() { if (w >= 1024) { $(".am-show-lg-only").show(); $(".am-hide-lg-only").hide(); } else { $(".am-show-lg-only").hide(); $(".am-hide-lg-only").show(); } } init(); //Top /*$("#go_top").click(function() { $("body,html").animate({ scrollTop: 0 }, 500); });*/ //滚动 /*$(window).scroll(function() { //置顶 if ($(window).scrollTop() > 100) { $("#go_top").fadeIn(500); } else { $("#go_top").fadeOut(500); } });*/