myBrowser(); function myBrowser() { 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("Edge") > -1; //鍒ゆ柇鏄惁IE鐨凟dge娴忚鍣 var isFF = userAgent.indexOf("Firefox") > -1; //鍒ゆ柇鏄惁Firefox娴忚鍣 var isSafari = userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") == -1; //鍒ゆ柇鏄惁Safari娴忚鍣 var isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1; //鍒ゆ柇Chrome娴忚鍣 if (isIE) { var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); reIE.test(userAgent); var fIEVersion = parseFloat(RegExp["$1"]); if (fIEVersion == 7) { $('body').html('
'); return "IE7"; } else if (fIEVersion == 8) { $('body').html('
'); return "IE8"; } else if (fIEVersion == 9) { $('body').html('
'); return "IE9"; } else if (fIEVersion == 10) { $('body').html('
'); return "IE10"; } else if (fIEVersion == 11) { return "IE11"; } else { return "0"; }//IE鐗堟湰杩囦綆 return "IE"; } if (isOpera) { return "Opera"; } if (isEdge) { return "Edge"; } if (isFF) { return "FF"; } if (isSafari) { return "Safari"; } if (isChrome) { return "Chrome"; } } function ajaxlist(urls,data,fun){ $.ajax({ url: urls, type: 'POST', data: data, dataType: 'html', beforeSend: function(data){ }, success: fun, complete:function(data){} }) } function getnav(item){ var oNav = $('.con-title-box'); //瀵艰埅澹 var aNav = oNav.find('.items'); //瀵艰埅 var aDiv = item; //妤煎眰 aNav.eq(0).addClass('active').siblings().removeClass("active"); $(window).scroll(function() { //鍙绐楀彛楂樺害 var winH = $(window).height(); //榧犳爣婊氬姩鐨勮窛绂 var iTop = $(window).scrollTop(); // //榧犳爣婊戝姩鏍峰紡鏀瑰彉 aDiv.each(function() { if (winH + iTop - $(this).offset().top > winH /5) { var _this = $(this).index(); // console.log(_this) aNav.removeClass('active'); aNav.eq(_this).addClass('active'); if($("body").hasClass("abhu")){ $(this).addClass("onm").siblings().removeClass("onm") } } }) if(iTop < 5){ aNav.eq(0).addClass('active').siblings().removeClass("active"); } }) aNav.on("click",function(){ var index = $(this).index(); var top = aDiv.eq(index).offset().top - $(".con-header").innerHeight(); $(this).addClass("active").siblings().removeClass("active"); $("body,html").animate({scrollTop:top},1000); }) } function bodyback(tops){ $("body,html").animate({scrollTop:tops},1000) } // $(".con-header .bocweb-header").on("mouseenter",function(){ // $(this).addClass("headactive") // }) // $(".con-header .bocweb-header").on("mouseleave",function(){ // $(this).removeClass("headactive") // }) $(".bocweb-header .searchs,.m-searchs span").on("click",function(){ $(".bocweb-header").toggleClass("headactive2"); $(".warp-search-form").stop().slideToggle(300); $(".dxnav__dropdown-overlay").toggleClass("overlay--open"); }) $(".search-form .search-close,.dxnav__dropdown-overlay").on("click",function(){ $(".bocweb-header").removeClass("headactive2"); $(".warp-search-form").stop().slideUp(300); $(".dxnav__dropdown-overlay").removeClass("overlay--open"); }) $(window).scroll(function(){ if($(window).scrollTop() >= $(window).innerHeight()/3){ $(".backtop").show(); }else{ $(".backtop").hide(); } var wraps = $(".con-header").offset().top; var tops = ($(window).scrollTop()); if(!$('body').hasClass("heise")){ if(wraps >= tops){ // $(".con-header .bocweb-header,.m-header").removeClass('fixed onactive'); // $("body").removeClass("onsactive-on"); }else if(wraps <= tops){ // $(".con-header .bocweb-header,.m-header").addClass('fixed onactive'); // $("body").addClass("onsactive-on"); }; }else{ } if(wraps >= tops){ $(".m-header").removeClass('fixed'); }else if(wraps <= tops){ $(".m-header").addClass('fixed'); }; if($("div").hasClass("con-title-boxbox")){ var wraps2 = $(".con-title-boxbox").offset().top; if((wraps2 >= tops) && (wraps2 > wraps)){ $(".con-title-box").removeClass('fixed'); }else if(wraps2 <= tops){ $(".con-title-box").addClass('fixed'); // $(".con-header .bocweb-header,.m-header").removeClass('fixed'); }; } }) $(".cons-swiper .swiper-slide").each(function(){ var _width = $(this).innerWidth(); var len = $(this).parents(".cons-swiper").find(".swiper-slide").length; var gs = parseInt($(this).parents(".cons-swiper").innerWidth()/_width); var btn = $(this).parents(".cons-swiper").find(".swiper-pagination"); var btn1 = $(this).parents(".cons-swiper").find(".swiper-button-prev"); var btn2 = $(this).parents(".cons-swiper").find(".swiper-button-next"); // console.log(len > gs,len , gs,$(this).parents(".cons-swiper").innerWidth()/_width); if(len > gs){ btn.show(); btn1.show(); btn2.show(); $(this).parents(".swiper-container").removeClass("swiper-no-swiping"); $(this).parents(".cons-swiper").removeClass("onactive") }else{ btn.hide(); btn1.hide(); btn2.hide(); $(this).parents(".cons-swiper").addClass("onactive") $(this).parents(".swiper-container").addClass("swiper-no-swiping"); } }) $(".conmmen-swiper").each(function(){ var _width = $(this).innerWidth(); var len,gs,_width; $(this).find(".swiper-slide").each(function(){ _width = $(this).innerWidth(); len = $(this).parents(".conmmen-swiper").find(".swiper-slide").length; gs = parseInt($(this).parents(".conmmen-swiper").innerWidth()/_width); }) var conswiper = $(this).attr("data-swiper"); var conmmen = conswiper if(len > gs){ conmmen = new Swiper('.conmmen-swiper[data-swiper='+conswiper+'] .swiper-container',{ pagination : '.conmmen-swiper[data-swiper='+conswiper+'] .swiper-pagination', prevButton:'.conmmen-swiper[data-swiper='+conswiper+'] .swiper-button-prev', nextButton:'.conmmen-swiper[data-swiper='+conswiper+'] .swiper-button-next', slidesPerView: "auto", paginationClickable: true, slideToClickedSlide:true, autoplayDisableOnInteraction: false, lazyLoading : true, loop:true, lazyLoadingInPrevNext : true, roundLengths : true, uniqueNavElements :false, speed:750 }) if($(this).hasClass("onsactive")){ setInterval(function(){ conmmen.slideNext() }, 5000); } if($(this).hasClass("onsactive2")){ setInterval(function(){ conmmen.slideNext() }, 6000); } }else{ } }) var titleswiper = new Swiper('.con-title-swiper .swiper-container',{ pagination : '.con-title-swiper .swiper-pagination', prevButton:'.con-title-swiper .swiper-button-prev', nextButton:'.con-title-swiper .swiper-button-next', slidesPerView: "auto", paginationClickable: true, // autoplay : 6000, // centeredSlides : true, slideToClickedSlide:true, autoplayDisableOnInteraction: false, lazyLoading : true, lazyLoadingInPrevNext : true, roundLengths : true, uniqueNavElements :false, speed:750 }) function mains(id,id1){ $(".bocweb-header .nav").eq(id).addClass("active").find(".nav-top").addClass("active"); $(".bocweb-header .nav.active").find(".nav-bots").find(".li").eq(id1).addClass("active"); if($("div").hasClass("con-title-box")){ $(".con-title-box .items").eq(id1).addClass("active"); if($("div").hasClass("con-title-swiper")){ titleswiper.slideTo(id1, 0, false); } } if($("div").hasClass("products-titles")){ $(".products-titles .items").eq(id1).addClass("active"); if($("div").hasClass("con-title-swiper")){ titleswiper.slideTo(id1, 0, false); } } } var lg = $("body").attr("data-lg"); var lk = $("body").attr("data-lk"); mains(lg,lk) var actives = $(".bocweb-header .nav.active").index(); var activeli = $(".bocweb-header .nav.active .nav-bots .li.active").index(); $(".bocweb-header .nav-top").on("mouseenter",function(){ $(this).addClass("active").parents(".nav").addClass("active").siblings().removeClass("active").find(".nav-top").removeClass("active"); $(this).siblings(".nav-bots").stop(true,true).slideDown().parents(".nav").siblings().find(".nav-bots").stop(true,true).slideUp(); }) $(".bocweb-header").on("mouseleave",function(){ $(".bocweb-header .nav-bots").stop(true,true).slideUp(); $(".bocweb-header .nav").removeClass("active").find(".nav-top").removeClass("active") $(".bocweb-header .nav").eq(actives).addClass("active").find(".nav-top").addClass("active"); }) $(".bocweb-header .nav.active .nav-bots .li").on("mouseenter",function(){ $(".bocweb-header .nav-bots .li").removeClass("active"); $(this).addClass("active").siblings().removeClass("active"); }) $(".bocweb-header .nav.active .nav-bots").on("mouseleave",function(){ $(".bocweb-header .nav-bots .li").removeClass("active") $(".bocweb-header .nav.active .nav-bots .li").eq(activeli).addClass("active") }) $(".con-title-box .items").on("mouseenter",function(){ $(this).addClass("active").siblings().removeClass("active"); }) $(".con-title-box .items").on("mouseleave",function(){ $(".con-title-box .items").removeClass("active") $(".con-title-box .items").eq(activeli).addClass("active") }) function clickVideo(selector){ var video = document.getElementById('video'); selector.on('click',function(){ $('.video-fixed').stop(true,true).removeClass('ons').hide(); $('.video-fixed').fadeIn().delay(500).addClass('ons'); // video.play(); $("html,body").addClass('on-foxed') var videoSrc = $(this).attr('data-swf'); $('#video').fadeIn(500).attr('src',videoSrc); }) $('.video-fixed .cha').on('click',function(){ $('.video-fixed').removeClass('ons').delay(500).fadeOut(); // video.pause(); $("html,body").removeClass('on-foxed') $('#video').fadeOut(500).attr('src',""); }) $(".video-fixed").on("click",function(){ $('.video-fixed').removeClass('ons').delay(500).fadeOut(); $("html,body").removeClass('on-foxed') $('#video').fadeOut(500).attr('src',""); }) $(".video-fixed .videoboxs").on("click",function(e){ e.stopPropagation() }) } function getUrlParam(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; } var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset:20, mobile: true, live: true }); wow.init(); $(".m-header .nav-btn").on('click', function() { var _this = $(this); if (!$(this).hasClass('hover')) { $(".search-bg").slideUp(); $(this).addClass('hover'); // $(this).children('.line1').stop().transition({rotate:45},300); // $(this).children('.line2').stop().fadeOut(300); // $(this).children('.line3').stop().transition({rotate:-45},300,function(){ // _this.addClass('active'); // }); $(this).parents(".w-header").siblings('.sub-menu').stop().fadeIn(); $(".m-header .list-cont").addClass('active'); $("body,html").addClass('ovh'); }else{ $(this).removeClass('hover'); $(this).removeClass('active'); // $(this).children('.line1').stop().transition({rotate:0},300); // $(this).children('.line2').stop().fadeIn(300); // $(this).children('.line3').stop().transition({rotate:0},300); $(this).parents(".w-header").siblings('.sub-menu').stop().fadeOut(); $(".m-header .list-cont").removeClass('active'); $("body,html").removeClass('ovh'); } }); $(".m-header .sub-menu .sub-tit").on('click', function() { $(".m-header .search-bg").slideUp(); 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(); } });