imgsrc(); $(".header-btnbox .navitems .serbtn").on("click",function(){ $(".bocweb-header").toggleClass("cur"); }) $(".m-header .nav-sousuo").on("click",function(){ $(" .search-dialogbox").fadeIn(); $('.search-dialog').stop().fadeIn(); $('.search-black').stop().fadeIn(); }) $('.search-close,.search-black').on('click',function(){ $(" .search-dialogbox").fadeOut(); $('.search-dialog').stop().fadeOut(); $('.search-black').stop().fadeOut(); }) function scrollAnimation2(ele) { $(ele).each(function() { var _this = $(this); if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) { // _this.removeClass('animate'); } else if ($(window).scrollTop() >= _this.offset().top - $(window).height() * 1) { _this.addClass('animate'); setInterval(function(){ $("body").addClass("avh0"); },50) // _this.find(".k10 .ul").addClass('animate'); _this.find(".loading-sw").remove(); } }); $(window).scroll(function(){ $(ele).each(function() { var _this = $(this); if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) { // _this.removeClass('animate'); } else if ($(window).scrollTop() >= _this.offset().top - $(window).height() * 1) { // console.log($(window).scrollTop() ,_this.offset().top - $(window).height() * 0.8) _this.addClass('animate'); // _this.find(".k10 .ul").addClass('animate'); _this.find(".loading-sw").remove(); } }); }); } //获取楼层 function getnav(item){ var oNav = $('.con-titles-swiper'); //导航壳 var aNav = oNav.find('.items'); //导航 var aDiv = item; //楼层 $(window).scroll(function() { //可视窗口高度 var winH = $(window).height(); //鼠标滚动的距离 var iTop = $(window).scrollTop(); if (iTop >= $(".con-titles-swiper").offset().top) { //鼠标滑动样式改变 aDiv.each(function() { if (winH + iTop - $(this).offset().top > winH / 3) { var _this = $(this).index(); aNav.removeClass('active'); aNav.eq(_this).addClass('active'); slideto(_this) } }) }else { var _this =0; aNav.removeClass('active'); aNav.eq(_this).addClass('active'); slideto(0); $(".con-titles-swiper .swiper-wrapper").css("transform","transform: translate3d(0px, 0px, 0px);") } }) aNav.on("click",function(){ var index = $(this).index(); var top = aDiv.eq(index).offset().top - $(".con-header").innerHeight(); $("body,html").animate({scrollTop:top},1000); }) } $(".bocweb-header .navbox .nav-tops").on("mouseenter",function(){ $(this).siblings(".nav-bots").stop().slideToggle().parents(".nav").siblings().find(".nav-bots").stop().hide(); }) $(".bocweb-header .navbox").on("mouseleave",function(){ $(".bocweb-header .navbox .nav-bots").hide(); }) var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset:20, mobile: true, live: true }); wow.init(); // $("img").lazyload(); function slideto(id2){ if($("div").hasClass("con-titles-swiper")){ var contitles = new Swiper('.con-titles-swiper .swiper-container', { slidesPerView : "auto", slideToClickedSlide:true }) contitles.slideTo(id2, 0, false); } } function mains2(id,id2){ $(".bocweb-header .navbox .nav").eq(id).addClass("active").find(".nav-tops").addClass("active"); $(".news-contitles .li").eq(id2).addClass("active").siblings().removeClass("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; } $(".bocweb-header").on("mouseenter",function(){ $(this).addClass("bgwhite"); }) $(".bocweb-header").on("mouseleave",function(){ $(this).removeClass("bgwhite"); }) $(window).scroll(function(){ var wraps=$(".con-header").offset().top; var tops = ($(window).scrollTop()); if(wraps >= tops){ $(".bocweb-header,.m-header").removeClass('fixed'); // $("body").removeClass("onsactive-on"); }else if(wraps <= tops){ $(".bocweb-header,.m-header").addClass('fixed'); // $("body").addClass("onsactive-on"); } }) // $(window).scroll(function(){ // var tops = ($(window).scrollTop()); // if($("div").hasClass("con-titles-swiper")){ // var tops2 = $(".con-titles-box").offset().top; // if(tops > tops2){ // $(".con-titles-swiper").addClass("fixed"); // $(".bocweb-header,.m-header").removeClass("fixed"); // }else{ // $(".con-titles-swiper").removeClass("fixed"); // $(".bocweb-header,.m-header").addClass("fixed"); // }; // } // }) $(".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(); } }); $(".bocweb-header .bocweb-nav .nav-tops").on("mouseenter",function(){ $(this).siblings(".nav-bots").stop().slideToggle().parents(".nav").siblings().find(".nav-bots").stop().hide(); }) $(".bocweb-header").on("mouseleave",function(){ $(".bocweb-header .bocweb-nav .nav-bots").slideUp(); }) $(".bocweb-footerbots .select .selects-tops").on("click",function(){ $(this).siblings(".selects-bots").stop().slideToggle(); }) function imgsrc(){ var nbox = $("[data-imgsrc]").length; var len = nbox; $("[data-imgsrc]").each(function(){ var _this = $(this); var src = _this.attr("data-imgsrc"); var img = new Image(); img.src = src; // console.log(img); if(_this.hasClass("isimg")){ _this.attr("src",src); }else{ _this.attr("style","background:url("+src+") no-repeat center;background-size:cover;"); } //处理ff下会自动读取缓存图片 if(img.complete || img.width){ nbox -- ; jdt = (len-nbox)/len; $("#number").html(Math.floor(jdt*100)+'%'); // console.log(jdt); if(nbox == 0){ $('.allimg #loader').stop().fadeOut(); } return; } $(img).load(function(){ nbox -- ; jdt = (len-nbox)/len; // console.log(jdt); $("#number").html(Math.floor(jdt*100)+'%'); if(nbox == 0){ $('.allimg #loader').stop().fadeOut(); } }); // if(_this.hasClass("isimg")){ // _this.attr("src",src); // }else{ // _this.attr("style","background:url("+src+") no-repeat center;background-size:cover;"); // } }) } $(".con-banner .con-words .more").on("click",function(){ var _top = $(".con-banner").innerHeight(); $("body,html").animate({scrollTop:_top},1000); })