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")); }