function scrollno(){ $(window).scroll(function(){ var before = $(window).scrollTop(); $(window).scroll(function() { var after = $(window).scrollTop(); if (before1024&&before>0) { $('.con-header').addClass('headroom-unpinned'); before = after; }; if (before>after&&window.innerWidth>1024) { $('.con-header').removeClass('headroom-unpinned'); before = after; }; }) }) } scrollno(); var has = $('.con-header').hasClass('headroom-unpinned'); $(".bocweb-header").on("mouseenter",function(){ has = $('.con-header').hasClass('headroom-unpinned'); if(has){ $('.con-header').removeClass("headroom-unpinned").addClass('headroom-unpinned2') } }) $(".bocweb-header").on("mouseleave",function(){ var h = $('.con-header').hasClass('headroom-unpinned2'); if(h){ $('.con-header').removeClass("headroom-unpinned2").addClass('headroom-unpinned') } }) function wow2(){ var wow2 = new WOW({ boxClass: 'wow2', animateClass: 'animated', offset:20, mobile: true, live: true }); wow2.init(); } var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset:20, mobile: true, live: true }); wow.init(); $('.backtops').on('click',function(){ $("body,html").animate({scrollTop:0},1000); }) $(window).scroll(function(){ if($(window).scrollTop() >= $(window).innerHeight()/3){ $(".backtops").show(); }else{ $(".backtops").hide(); } var wraps = $(".con-header").offset().top; if($('div').hasClass('cons-tit-box')){ var wraps2s = $(".cons-tit-box").offset().top; } var tops = ($(window).scrollTop()); // console.log(wraps >= tops,wraps , tops) if(!$("body").hasClass('searchbody')){ if(wraps >= tops){ $(".con-header .bocweb-header,.m-header").removeClass('fixed onactive'); }else if(wraps < tops){ $(".con-header .bocweb-header,.m-header").addClass('fixed onactive'); }; } if(wraps2s){ if(wraps2s >= tops){ $(".con-header .bocweb-header").removeClass('fixed-onactive'); $(".cons-tit-box").removeClass("fixed"); }else if(wraps2s < tops){ $(".con-header .bocweb-header").addClass('fixed-onactive'); $(".cons-tit-box").addClass("fixed"); }; } }) function ajaxlist(urls,data,fun){ $.ajax({ url: urls, type: 'POST', data: data, dataType: 'html', beforeSend: function(data){ }, success: fun, complete:function(data){} }) } swipercomen(); function swipercomen(){ $(".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)-1; 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"); if($(this).parents("cons-swiper").hasClass("gfks")){ gs=gs+1; } // 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)-1; }) if($(this).hasClass("gfks")){ gs=gs+1; } var conswiper = $(this).attr("data-swiper"); var conmmen = conswiper; // console.log(len == gs,len , gs) if(len > gs){ var loop = false; var onclick = false; if($(this).hasClass("swiper-loop")){ loop = true; } if($(this).hasClass("swiper-click")){ onclick = true; } 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:onclick, autoplayDisableOnInteraction: false, loop:loop, lazyLoadingInPrevNext : true, roundLengths : true, uniqueNavElements :false, speed:750 }) if($(this).hasClass("onsactive")){ setInterval(function(){ conmmen.slideNext() }, 5000); } if($(this).hasClass("swiper-click")){ $(this).find('.swiper-slide').click(function(){ var index = $(this).index(); conmmen.slideTo(index,500,false) }) } }else{ } }) } $(".bocweb-header .nav-tops").on("mouseenter",function(){ $(this).siblings(".nav-bots").stop(true,true).slideDown().parents(".nav").siblings().find(".nav-bots").stop(true,true).hide(); }) $(".bocweb-header .nav").on("mouseleave",function(){ $(".bocweb-header .nav-bots").stop(true,true).slideUp(); }) $(".bocweb-header .boc-right .searchs,.m-searchs span").on("click",function(){ $(".bocweb-header").addClass("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"); }) 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").removeClass("active cur2").find(".nav-tops").removeClass("active cur2"); $(".bocweb-header .nav").eq(id).addClass("active").find(".nav-tops").addClass("active"); $(".bocweb-header .nav").eq(id).addClass("cur2") $(".bocweb-header .nav.active").find(".nav-bots").find(".li").removeClass('active').eq(id1).addClass("active"); // $(".content-list .menu-bots .li").eq(id1).addClass('active').siblings().removeClass('active'); $('.bocweb-header .nav.active .nav-bots').find('.li').eq(id1).addClass('active').siblings('.li').removeClass('active') $(".con-title-swiper .cons-tits .li,.con-tit-banner .li").eq(id1).addClass("active"); } var lg = $("body").attr("data-lg"); var lk = $("body").attr("data-lk"); mains(lg,lk); $(".bocweb-header .boc-right .langs-tops").on("mouseenter",function(){ $(this).siblings(".langs-bots").slideDown(); }) $(".bocweb-header .boc-right .langs").on("mouseleave",function(){ $(this).find(".langs-bots").slideUp(); }) function clickVideo(selector){ var video = document.getElementById('video'); selector.on('click',function(){ $('.video-fixed').stop(true,true).removeClass('ons').hide(); $('.video-fixed').fadeIn().addClass('ons'); // video.play(); $("html,body").addClass('on-foxed') var videoSrc = $(this).attr('data-src'); $('#video').fadeIn().attr('src',videoSrc); if($(this).hasClass("img-click")){ $(".video-fixed img.imghide").show().attr('src',videoSrc); $('#video').hide().attr('src',""); }else{ $("img.imghide").hide().attr('src',""); $('#video').show().attr('src',videoSrc); } }) $('.video-fixed .cha').on('click',function(){ $('.video-fixed').removeClass('ons').fadeOut(); // video.pause(); $("html,body").removeClass('on-foxed') $('.video-fixed img.imghide').fadeOut().attr('src',""); $('#video').fadeOut().attr('src',""); }) $(".video-fixed").on("click",function(){ $('.video-fixed').removeClass('ons').fadeOut(); $("html,body").removeClass('on-foxed') $('#video').fadeOut().attr('src',""); }) $(".video-fixed .videoboxs").on("click",function(e){ e.stopPropagation() }) } clickVideo($(".con-videos")) clickVideo($(".mvideo")) 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; } $(".m-header .nav-btn").on('click', function() { var _this = $(this); if (!$(this).hasClass('hover')) { $(".search-bg").slideUp(); $(this).addClass('hover'); $(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).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(); $(this).siblings('.sec-list').slideToggle().parents(".bocweb-submenu").siblings().find(".sec-list").slideUp(); // $(".sec-list").addClass("on") // console.log($(this).siblings('.sec-list').is(':hidden')) if ($(this).siblings('.sec-list').is(':hidden')){ // $(this).siblings('.sec-list').slideDown(); // .stop().slideDown(); // $(this).parent().siblings('li').children('.sec-list').stop().slideUp().siblings('.tit').removeClass('on'); }else{ // $(this).siblings('.sec-list').slideUp(); // $(this).removeClass('on'); // $(this).siblings('.sec-list').addClass('on'); // .stop().slideUp(); } }); $(".m-header .sub-menu .sec-list .tops").on("click",function(){ $(this).parents(".sec-list").removeClass('on'); // .slideUp(); $(this).parents(".bocweb-submenu").find("span.tit.sub-tit").removeClass("on"); }) $(".bocweb-header .boc-leftbtns .btns").on("click",function(){ $(this).toggleClass("active"); $(".con-header-box").fadeToggle(); $("body,html").toggleClass("wel-active"); }) $(".m-header .sub-menu .sec-list .lis-tops").on("click",function(){ $(this).siblings(".lis-bots").slideToggle() }) $(".bocweb-header .fr-navbox .i2 .itops").on("mouseenter",function(){ $(this).siblings(".ibots").fadeIn(); }) $(".bocweb-header .fr-navbox .i2").on("mouseleave",function(){ $(this).find(".ibots").fadeOut(); }) function getnav(item){ var oNav = $('.cons-tit-box .cons-tits'); //导航壳 var aNav = oNav.find('.li'); //导航 var aDiv = item; //楼层 aNav.eq(0).addClass('active').siblings().removeClass("active"); var scrolh = 50; if($(window).innerWidth()>1023){ scrolh = $(".bocweb-header").innerHeight(); }else{ scrolh = 50; } $(window).scroll(function() { //可视窗口高度 var winH = $(window).height(); //鼠标滚动的距离 var iTop = $(window).scrollTop(); // //鼠标滑动样式改变 aDiv.each(function() { if (winH + iTop - $(this).offset().top > winH /2) { var _this = $(this).index(); // console.log(_this) titleswiper.slideTo(_this,1000,false); aNav.removeClass('active'); aNav.eq(_this).addClass('active'); } }) if(iTop < 5){ aNav.eq(0).addClass('active').siblings().removeClass("active"); } }) aNav.on("click",function(){ var ths = 0; if($('div').hasClass("cons-tit-box")){ ths = $('.cons-tit-box').innerHeight() } var index = $(this).index(); var top = aDiv.eq(index).offset().top - scrolh - ths; $(this).addClass("active").siblings().removeClass("active"); titleswiper.slideTo(index,1000,false); $("body,html").animate({scrollTop:top},1000); }) var md = getUrlParam('md'); if(md){ md =md -1; var lg = $("body").attr("data-lg"); var lk = $("body").attr("data-lk"); setTimeout(function(){ aNav.eq(md).click(); mains(lg,md); },1000) } } if($("div").hasClass('cons-tit-box-active')){ getnav($(".commenlist-list .list")); }