$(function(){ $(".pc-bocweb-header3 .header .nav .li").hover(function() { $(this).find(".nav-item").stop(true,true).delay(300).slideDown(400); },function(){ $(this).find(".nav-item").stop(true,true).delay(300).slideUp(400); } ); $(".m-bocweb-header3 .header2 .hamburger").on("click",function(){ if ($(this).hasClass("is-active")) { $(this).removeClass("is-active"); $(".m-bocweb-header3 .warp-nav").stop(true,false).hide(0); $("body,html").removeClass("ovh"); $(".m-bocweb-header3 .header2 .nav .li").removeClass("animate"); if (!$(".m-bocweb-header3").hasClass("on")) { $(".m-bocweb-header3").removeClass("active"); } }else{ $(this).addClass("is-active"); $(".m-bocweb-header3 .warp-nav").stop(true,false).show(0); $("body,html").addClass("ovh"); $(".m-bocweb-header3 .header2 .nav .li").addClass("animate"); if (!$(".m-bocweb-header3").hasClass("on")) { $(".m-bocweb-header3").addClass("active"); } } }) var _colSpan= $('.m-bocweb-header3 .header2 .nav .li'); var _len=_colSpan.length; var i=0; for(i;i<_len;i++){ _colSpan.eq(i).css({ 'transition-delay': 0.1 + 0.04*(i+1)+'s' }); } $(".m-bocweb-header3 .header2 .sub-tit").on('click', function() { if ($(this).siblings('.sec-list').is(':hidden')){ $(this).addClass('on'); $(this).siblings('.sec-list').stop().slideDown(); $(this).parent().siblings('li').children('.sec-list').stop().slideUp().siblings('.tit').removeClass('on'); }else{ $(this).removeClass('on'); $(this).siblings('.sec-list').stop().slideUp(); } }); var _id = getUrlParam('id'); if(_id){ setTimeout(function(){ $('.footer-top .rightbox .tit3,.n-subnav .right-nav .li').eq(_id).click(); $('html,body').stop().animate({scrollTop:$('.position').eq(_id).offset().top},500) },1000) } // 友情链接 $(".linkbox1 .link-title").on("click",function() { $(this).siblings().stop().delay(100).slideToggle(); }) //入场动画 scrollAni(); if ($(window).width()>767) { $(".n-banner .downbtn").on("click",function(){ $('html,body').stop().animate({scrollTop:$('.warp-subnav').offset().top},500) }) }else{ $(".n-banner .downbtn").on("click",function(){ $('html,body').stop().animate({scrollTop:$('.n-banner').height()+$(".bocweb-header3").height()},500) }) } $(".about-list7 .rightbox .icon").on("click",function(){ $('html,body').stop().animate({scrollTop:$('.about-list7 .bottombox').offset().top},500) }) $(window).scroll(function() { if (!$(".m-bocweb-header3").hasClass("on")) { if ($(window).scrollTop()>0) { $(".m-bocweb-header3").addClass("active"); }else{ $(".m-bocweb-header3").removeClass("active"); } } }); // var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 // var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 // var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 // var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; // if(isIE) { // var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); // reIE.test(userAgent); // var fIEVersion = parseFloat(RegExp["$1"]); // if(fIEVersion == 7) { // //return 7; // } else if(fIEVersion == 8) { // //return 8; // } else if(fIEVersion == 9) { // //return 9; // } else if(fIEVersion == 10) { // //return 10; // } else { // //return 6;//IE版本<=7 // } // } else if(isEdge) { // //return 'edge';//edge // } else if(isIE11) { // //return 11; //IE11 // }else{ // $(window).scroll(function(){ // var windowTop=jQuery(window).scrollTop(); // var windowTop2=jQuery(window).scrollTop()/4; // if (windowTop >=0) { // jQuery('.n-banner .bg-banner').css('transform',"translate(0px,"+(windowTop) / 1.5+"px) scale("+(1+(windowTop2) / $(window).height())+");"); // }; // }); // } if ($(window).width()>767) { navScroll(); } }) function navScroll(){ //图片全部预加载 var preImg = []; $('img').each(function(index,el){ preImg.push($(el).attr('src')); }) _PreLoadImg(preImg,function(){ var winTop = $(window).scrollTop(); var containerTop = $('.warp-subnav').offset().top; //二级导航悬浮 if(winTop>=containerTop){ $('.n-subnav').addClass('active'); }else{ $('.n-subnav').removeClass('active'); } //滚动事件 $(window).on('scroll resize',function(){ winTop = $(window).scrollTop(); containerTop = $('.warp-subnav').offset().top; if(winTop>=containerTop){ $('.n-subnav').addClass('active'); }else{ $('.n-subnav').removeClass('active'); } if($('.position').length>0){ var _length = $('.position').length; for(var i = 0;i < _length ; i++){ if($(window).scrollTop()>=$('.position').eq(i).offset().top-$('.warp-subnav').outerHeight()){ $('.n-subnav a').eq(i).addClass('cur').siblings().removeClass('cur'); } } } }) //二级导航点击事件 if ($(".position").length>1) { $('.n-subnav a').on('click',function(){ var i = $(this).index(); if(window.innerWidth>1024){ $('html,body').stop().animate({scrollTop:$('.position').eq(i).offset().top-$('.warp-subnav').outerHeight()+2},500) } }) } //导航点击事件,页面定位 var _id = getUrlParam('id'); if(_id){ setTimeout(function(){ //有二级导航的 $('.n-subnav a').eq(_id).click(); //没有二级导航,用animate,移动高度 $('html,body').stop().animate({scrollTop:$('.position').eq(_id).offset().top-$('.warp-subnav').outerHeight()+2},500) },1000) } }) }