function conswiper(num){ $(".cons-swiper").each(function(){ var _this = $(this); var _allwidth=0; var buttonwidth = 0; var autoi = "auto"; if($('div').hasclass("swiperwidth")){ buttonwidth = _this.find(".swiperwidth").innerwidth(); } var allwidth=_this.innerwidth(); _this.find(".swiper-slide").each(function(){ var _width = $(this).outerwidth(true); _allwidth+=_width; if(_width == allwidth){ autoi = 1; }else{ if(_this.hasclass('autoslides')){ autoi = parseint(allwidth/_width); } } }) if(math.ceil(_allwidth)<=math.ceil(allwidth)){ _this.addclass("onac"); _this.find(".swiper-container").addclass("swiper-no-swiping"); if((num != undefined) && _this.hasclass("swiper-active")){ _this.find(".swiper-slide").eq(num).addclass("active").siblings().removeclass("active"); } }else{ _this.addclass("ckwidth"); var onloop = false; var onclick = false; var autoplays= false; var iscenter =false; if($(this).hasclass("swiper-click")){ onclick = true; } if($(this).hasclass("c-swiper-center")){ iscenter = true; } if($(this).hasclass("onloop")){ onloop = true; } if($(this).hasclass("onautoplay")){ autoplays = 5000; } var conswiper2 = $(this).attr("data-swiper"); var conmmen = conswiper2; conmmen = new swiper('.cons-swiper[data-swiper='+conswiper2+'] .swiper-container',{ pagination : '.cons-swiper[data-swiper='+conswiper2+'] .swiper-pagination', prevbutton:'.cons-swiper[data-swiper='+conswiper2+'] .swiper-button-prev', nextbutton:'.cons-swiper[data-swiper='+conswiper2+'] .swiper-button-next', slidesperview: autoi, centeredslides : iscenter, spacebetween : buttonwidth, paginationclickable: true, loop:onloop, slidetoclickedslide:onclick, autoplay:autoplays, autoplaydisableoninteraction: false, lazyloading : true, lazyloadinginprevnext : true, speed:750 }) if($(this).hasclass("swiper-click")){ _this.find(".swiper-slide").on("click",function(){ conmmen.slideto($(this).index(),500,false); }) } if(num && _this.hasclass("swiper-active")){ _this.find(".swiper-slide").eq(num).addclass("active").siblings().removeclass("active") conmmen.slideto(num,500,false); }else{} } }) } function ajaxmore(datas){ var texts = datas; $(".ajax-more .span").each(function(){ var _this = $(this).parents(".ajax-more"); var knums = _this.attr("data-num"); if(knums > 1){ _this.show(); }else{ _this.hide(); } }) var p = 1; var sum=0; $(document).on("click",".ajax-more .span",function(){ var _this = $(this).parents(".ajax-more"); var newurl = _this.attr("data-url"); sum= _this.attr("data-num"); p += 1; if(!texts){ datas = {page:p}; } $.ajax({ url: newurl, type: 'post', data: datas, cache: false, async:false, datatype: 'html', beforesend: function(){ }, success: function (html) { if(p>sum){ $(".ajax-more .span").hide(); }else if(p>=sum){ $(".ajax-more .span").hide(); _this.parents(".ajax-box").find(".ajax-ajax").append(html); }else{ _this.parents(".ajax-box").find(".ajax-ajax").append(html); } } }); return false; }) } function clickvideo(selector){ var video = document.getelementbyid('video'); $(document).on('click',selector,function(){ $('.video-fixed').stop(true,true).removeclass('ons').hide(); $('.video-fixed').fadein().addclass('ons'); $("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(); $("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-fixed img.imghide').fadeout().attr('src',""); $('#video').fadeout().attr('src',""); }) $(".video-fixed .videoboxs").on("click",function(e){ e.stoppropagation() }) } function titleswiper(num){ $(document).find(".titles-swiper").each(function(){ var _this = $(this); var _allwidth=0; var allwidth=_this.innerwidth()+2; _this.find(".swiper-slide").each(function(){ var _width = $(this).outerwidth(true); _allwidth+=_width; }) _this.find(".swiper-slide").eq(num).addclass("active").siblings().removeclass("active"); if(math.ceil(_allwidth)<=allwidth){ _this.addclass("onac") }else{ var conswiper = $(this).attr("data-swiper"); var conmmen = conswiper; conmmen = new swiper('.titles-swiper[data-swiper='+conswiper+'] .swiper-container',{ pagination : '.titles-swiper[data-swiper='+conswiper+'] .swiper-pagination', prevbutton:'.titles-swiper[data-swiper='+conswiper+'] .swiper-button-prev', nextbutton:'.titles-swiper[data-swiper='+conswiper+'] .swiper-button-next', slidesperview: "auto", paginationclickable: true, slidetoclickedslide:true, autoplaydisableoninteraction: false, lazyloadinginprevnext : true, roundlengths : true, uniquenavelements :false, speed:750 }) if(num){ conmmen.slideto(num,500,false) } } }) } function getmains(id,id2){ $(".con-header .boxs .nav").eq(id).addclass("active").find(".nav-tops").addclass("active"); $(".con-header .boxs .nav.active .nav-bots .i").eq(id2).addclass("active"); // titleswiper(id2); } function wownew(){ var wow = new wow({ boxclass: 'wow', animateclass: 'animated', offset:100, mobile: true, live: true }); wow.init(); // var _zoom = document.getelementsbytagname ('body')[0].style.zoom; // if(_zoom == 1){ // _zoom = 0; // var wow = new wow({ // boxclass: 'wow', // animateclass: 'animated', // offset:_zoom, // mobile: true, // live: true // }); // wow.init(); // }else if(_zoom > 1){ // _zoom = -100; // var wow = new wow({ // boxclass: 'wow', // animateclass: 'animated', // offset:_zoom, // mobile: true, // live: true // }); // wow.init(); // }else if(_zoom >= 0.8){ // _zoom = -350; // var wow = new wow({ // boxclass: 'wow', // animateclass: 'animated', // offset:_zoom, // mobile: true, // live: true // }); // wow.init(); // }else{ // $(".wow").css({ // 'visibility': 'visible', // 'animation-name': 'fadeinup', // 'opacity':'1' // }).addclass("cuy") // } } function selectsbox(){ $(".selects .selects-tops").on("click",function(){ $(this).parents(".selects").toggleclass("active").siblings().removeclass("active"); $(this).siblings(".selects-bots").stop().slidetoggle().parents(".selects").siblings().find(".selects-bots").stop().hide(); }) $(".selects .selects-bots .i").on("click",function(){ var _text = $(this).text(); $(this).parents(".selects").removeclass("active") $(this).parents(".selects-bots").slideup().siblings(".selects-tops").text(_text); var did = $(this).attr("data-id"); $(this).parents(".selects").attr("data-id",did); $(this).parents(".selects").find("input").val(did); }) $(".selects").on("click",function(e){ e.stoppropagation(); }) $(document).on("click",function(){ $(".selects .selects-bots").stop(false,true).slideup(); }) } selectsbox(); function ajaxlist(urls,data,fun){ $.ajax({ url: urls, type: 'post', data: data, datatype: 'html', beforesend: function(data){ }, success: fun, complete:function(data){} }) } wownew(); // 返回顶部 $(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 - $(".cons-tit-box").innerheight(); } var tops = ($(window).scrolltop()); if(wraps >= tops){ $(".con-header").removeclass('fixed headeractive'); }else if(wraps < tops){ $(".con-header").addclass('fixed headeractive'); }; if(wraps2s){ if(wraps2s >= tops){ $(".bocweb-header").removeclass('fixed-onactive'); $(".cons-tit-box").removeclass("fixed"); }else if(wraps2s < tops){ $(".bocweb-header").addclass('fixed-onactive'); $(".cons-tit-box").addclass("fixed"); }; } }) $(".bocweb-header .nav-lists .nav-tops").on("mouseenter",function(){ $(this).siblings().stop().slidedown().parents(".nav").siblings().find(".nav-bots").stop().slideup(); }) $(".bocweb-header .nav-lists .nav").on("mouseleave",function(){ $(".bocweb-header .nav-lists .nav-bots").stop().slideup(); }) $(".w-header .langs .langs-tops").on("click",function(){ $(this).siblings(".langs-bots").slidetoggle(); }) // 手机导航 $(".m-header .nav-btn").on('click', function() { var _this = $(this); $(".conmmen-bg").hide(); 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'); $("#choose-box").hide(); } }); $(".m-header .sub-menu .sub-tit").on('click', function() { $(this).toggleclass("on").parents(".bocweb-submenu").toggleclass("active").siblings().removeclass("active").find(".sub-tit").removeclass("on"); $(".m-header .search-bg").slideup(); $(this).siblings('.sec-list').slidetoggle().parents(".bocweb-submenu").siblings().find(".sec-list").slideup(); }); $(".m-header .sub-menu .sec-list .tops").on("click",function(){ $(this).parents(".sec-list").removeclass('on'); $(this).parents(".bocweb-submenu").find("span.tit.sub-tit").removeclass("on"); }) $(".m-header .sub-menu .sec-list .lis-tops").on("click",function(){ $(this).siblings(".lis-bots").slidetoggle() })